import os
import json
import random
import re
import math
import datetime
import time
import copy
import asyncio
from botpy.message import GroupMessage
from tools import send_message, player_id, player_name, player_number, player_read, player_write, txt_write, txt_exist, bag_add, bag_reduce, exp_up, bag_enough, bag_number, sell_price
from battle import battle_initialization, attribute_count

async def daily_wish(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    wish_want = message.content.split("祈祷")[1]
    can_wish = ["财富", "强大", "幸运"]
    if wish_want not in can_wish:
        txt = "\n请在心底默默祈祷————\n◈[祈祷财富]\n◈[祈祷强大]\n◈[祈祷幸运]"
        await send_message(message, 0, 1, txt)
        return
    today = datetime.date.today().strftime('%Y-%m-%d')
    with open(f"data/player/{uid}.txt", 'r') as f:
        data = json.load(f)
    if "签到时间" not in data:
        data["签到时间"] = ""
    if data["签到时间"] == today:
        txt = "\n命运不会在短时间内眷顾于同一人哦~"
        await send_message(message, 0, 1, txt)
        return
    else:
        data["签到时间"] = today
        with open(f"data/每日祈祷.txt", 'r') as f:
            wish_data = json.load(f)
        wish = wish_data[wish_want]
        # 计算总概率
        total_prob = sum([item["概率"] for item in wish])
        # 生成随机数
        rand_num = random.uniform(0, total_prob)
        # 遍历列表，累加概率，直到累加的概率大于等于随机数
        cumulative_prob = 0
        for item in wish:
            cumulative_prob += item["概率"]
            if rand_num <= cumulative_prob:
                get_thing = item
                break
        thing_name = get_thing["名称"]
        thing_number = get_thing["数量"]
        await bag_add(uid, thing_name, thing_number)
        txt = "\n一颗闪亮的流星划破天际，那是又一个梦想在破茧成蝶。\n虚空微微颤动，你望着眼前浮现的轮廓，感受着来自命运的馈赠。\n伴随一阵金光乍现————\n你获得了 [{}] × {} ！".format(thing_name, thing_number)
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        await send_message(message, 0, 1, txt)
        return




async def move(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    await attribute_count(message)
    txt = ""
    with open(f"data/player.txt", 'r') as f:
        player_data = json.load(f)
        for player_item in player_data:
            if player_item["number"] == number:
                place00 = player_item["地名"]
                if message.content == "上":
                    player_item["y"] += 1
                elif message.content == "下":
                    player_item["y"] -= 1
                elif message.content == "左":
                    player_item["x"] -= 1
                elif message.content == "右":
                    player_item["x"] += 1
                x = player_item["x"]
                y = player_item["y"]
                id = player_item["id"]
                break

    with open(f"data/map/坐标总览.txt", 'r') as f:
        data = json.load(f)
        place = "未知之地"
        if_found_place = False
        for location in data:
            for coordinate in location['坐标']:
                if coordinate['x1'] <= x <= coordinate['x2'] and coordinate['y1'] <= y <= coordinate['y2']:
                    place = location['名称']
                    player_item["地名"] = place
                    if_found_place = True
                    break
            if if_found_place:
                break
    """二次转职地点判定"""

    job_place = ["崖边茅庐", "破败教会"]

    if place not in job_place:
        if message.content != "上" and message.content != "下" and message.content != "左" and message.content != "右":
            return
        else:
            with open(f"data/player.txt", 'w') as f:
                json.dump(player_data, f, ensure_ascii=False, indent=4)
            txt += "\n你移动至【{}({},{})】".format(place, x, y)
    else:
        place1 = place
        if_npc_action = True
        if message.content == "上" or message.content == "下" or message.content == "左" or message.content == "右":
            with open(f"data/player.txt", 'w') as f:
                json.dump(player_data, f, ensure_ascii=False, indent=4)
            txt += "\n你移动至【{}({},{})】".format(place, x, y)
        elif str(message.content) == "1" or str(message.content) == "2" or str(message.content) == "3":
            place1 = place00 + str(message.content)
        elif str(message.content) == "0":
            last_digit_index = len(place00) - 1
            while last_digit_index >= 0 and place00[last_digit_index].isdigit():
                last_digit_index -= 1
            place1 = place00[:last_digit_index + 1]

        with open(f"data/player/{uid}.txt", 'r') as f:
            player0_data = json.load(f)
        if place1 == "崖边茅庐":
            txt += "\n你面前浮现一座破旧的茅草小屋，似乎有人生活的痕迹。\n————————————\n[1] 上前敲门"
        elif place1 == "崖边茅庐1":
            txt += "\n【崖边茅庐】\n你敲了敲门，门吱呀开了。\n“进来吧！”\n门内传来颓然的声音。\n————————————\n[1] 进屋"
        elif place1 == "崖边茅庐11":
            txt += "\n【崖边茅庐·屋内】\n一道身影背向你端坐在蒲团上，长发及腰，双目紧闭。\n————————————\n[1] 问剑\n[2] 攻击"
        elif place1 == "崖边茅庐111":
            if player0_data["一转"] != "战士" or player0_data["等级"] < 30:
                place1 = "崖边茅庐11"
                txt += "\n【崖边茅庐·无名剑圣】\n“我不与无为者论剑。”\n————————————\n[0] 离开"
            elif player0_data["剧情任务记录"].get("无名剑圣_给予试炼", 0) == 0:
                txt += "\n【崖边茅庐·无名剑圣】\n“是非成败转头空，不羡功名已万重。”\n他睁开双目，望向崖上那无想的一剑，眼神中透露出一丝迷离。\n“这是何等惊艳的一剑。我已参悟20余年，始终望尘莫及。”\n————————————\n[1] 虚心求教"
            elif player0_data["剧情任务记录"].get("无名剑圣_完成试炼1", 0) == 0:
                txt += "\n【崖边茅庐·无名剑圣】\n沉默不语。。。\n————————————\n[1] 提交试炼"
            elif player0_data["剧情任务记录"].get("无名剑圣_完成试炼2", 0) == 0:
                txt += "\n【崖边茅庐·无名剑圣】\n“来吧！让我康康你的实力！”\n————————————\n[1] 开始/提交试炼"
            elif player0_data["剧情任务记录"].get("无名剑圣_完成试炼3", 0) == 0:
                txt += "\n【崖边茅庐·无名剑圣】\n沉默不语。。。\n————————————\n[1] 提交试炼"
            else:
                txt += "\n【崖边茅庐·无名剑圣】\n沉默不语。。。\n————————————\n[1] 新的试炼"
        elif place1 == "崖边茅庐1111":
            
            if player0_data["剧情任务记录"].get("无名剑圣_给予试炼", 0) == 0:
                place1 = "崖边茅庐111"
                txt += "\n【崖边茅庐·无名剑圣】\n“与我问剑，不求实力，但求天分。”\n他将腰间佩剑缓缓出鞘，在面前端详，眸光似水。\n“传授你我独特的一招养剑之法，我只演示一遍。”\n你感受到一丝凌厉的剑意自他蔓延，那柄佩剑上的色泽也愈加冷厉，有无比锋利的剑气满溢。\n他眼神微转，一剑劈向头顶，一道剑气喷薄而出，屋顶瞬间化为粉末。\n凌厉的剑气继续奔向穹顶，直到望所不及。\n“悟了吗？”\n“交给你个任务吧。你若是能一人击败[乱石滩地]的[刺毛猪]与[纯水精灵],我便承认你的天分。”\n————————————\n★接受任务★\n【单挑[刺毛猪]】\n【单挑[纯水精灵]】"
                player0_data["学会技能"].append({"名称": "拭剑", "等级": 1, "熟练度": 0})
                player0_data["任务"].append({"名称": "剑影·试炼1", "来源": "无名剑圣", "类型": "等阶突破", "目标": [{"类型": "单挑", "对象": "刺毛猪", "数量": 1, "已讨伐": 0}, {"类型": "单挑", "对象": "纯水精灵", "数量": 1, "已讨伐": 0}], "奖励": "事件*剑圣的认可", "剩余时间": "无期限", "编码": 0})
                player0_data["剧情任务记录"]["无名剑圣_给予试炼"] = 1
                with open(f"data/player/{uid}.txt", 'w') as f:
                    json.dump(player0_data, f, ensure_ascii=False, indent=4)
            elif player0_data["剧情任务记录"].get("无名剑圣_完成试炼1", 0) == 0:
                place1 = "崖边茅庐111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "剑影·试炼1" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【崖边茅庐·无名剑圣】\n“我不授沽名钓誉之人！”"
                else:
                    txt += "\n【崖边茅庐·无名剑圣】\n“你做的很不错，有实力也有天分。”\n他满意的打量着你。\n“跟我过过招吧，我会压制我的力量。”\n“要是能通过我这关，便有资格接手这份力量与责任！”\n————————————\n★接受任务★\n【单挑[无名剑影]】"
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '剑影·试炼1']
                    player0_data["任务"].append({"名称": "剑影·试炼2", "来源": "无名剑圣", "类型": "等阶突破", "目标": [{"类型": "单挑", "对象": "无名剑影", "数量": 1, "已讨伐": 0}]})
                    player0_data["剧情任务记录"]["无名剑圣_完成试炼1"] = 1
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
            
            elif player0_data["剧情任务记录"].get("无名剑圣_完成试炼2", 0) == 0:
                place1 = "崖边茅庐111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "剑影·试炼2" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【崖边茅庐·无名剑圣】\n“准备好了吗？”\n剑意开始弥漫！\n★★★进入战斗★★★\n————————————\n【无名剑影】Lv.30\n◇战斗面板\n◇普攻\n◇技能x\n◇使用x"
                    await battle_initialization("无名剑影", 30, message, "全能")
                else:
                    txt += "\n【崖边茅庐·无名剑圣】\n“很好，我越来越欣赏你了。”\n他环顾四周，似乎在找寻什么，然后一脸诧然。\n“呀！我在交给你最后一个试炼，你若是能完成，我便收你为徒！”\n————————————\n★接受任务★\n【收集[木材]*1000】\n【收集[茅草]*1000】"
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '剑影·试炼2']
                    player0_data["任务"].append({"名称": "剑影·试炼3", "来源": "无名剑圣", "类型": "等阶突破", "目标": [{"类型": "收集", "对象": "木材", "数量": 1000}, {"类型": "收集", "对象": "茅草", "数量": 1000}], "奖励": "事件*转职[剑影]", "剩余时间": "无期限", "编码": 0})
                    player0_data["剧情任务记录"]["无名剑圣_完成试炼2"] = 1
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
            
            elif player0_data["剧情任务记录"].get("无名剑圣_完成试炼3", 0) == 0:
                place1 = "崖边茅庐111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "剑影·试炼3" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【崖边茅庐·无名剑圣】\n“数量还不够哦？”"
                else:
                    txt += "\n【崖边茅庐·无名剑圣】\n“你做得很好！”\n言毕，他化为了一道残影，四周掀起风澜。你感受到一阵疾风将你笼罩。\n他在你头顶轻轻一点，无比磅礴的信息涌入你的脑海。\n“这便是我的传承，愿你勇往直前，达到这断崖上无想的一剑！”\n“等到时机合适之时可以再来找我，我会传授予你更为强大的力量！”\n————————————\n★完成试炼★\n【已转职[剑影]】"
                    await bag_reduce(uid, "木材", 1000)
                    await bag_reduce(uid, "茅草", 1000)
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '剑影·试炼3']
                    player0_data["剧情任务记录"]["无名剑圣_完成试炼3"] = 1
                    player0_data["二转"] = "剑影"
                    player0_data["学会技能"].append({"名称": "其行如风", "等级": 1, "熟练度": 0})
                    player0_data["学会技能"].append({"名称": "瞬息千刃", "等级": 1, "熟练度": 0})
                    txt_明道 = "\n强大的力量充盈着你的体魄。\n你感到压抑已久的枷锁悄然破碎，身躯变得无比轻盈。\n————————————\n【[{}]突破灵阶枷锁】\n————————————\n【等级上限提升！】\n【开化➡明道】".format(player0_data["nickname"])
                    player0_data["装备技能"]["数量"] += 1
                    player0_data["灵阶"] = 4
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
                    asyncio.create_task(send_message(message, 2, 5, txt_明道))
            
            else:
                if player0_data["等级"] < 35:
                    place1 = "崖边茅庐11"
                    txt += "\n【崖边茅庐·无名剑圣】\n“变强点再来吧！”\n————————————\n[0] 离开"

        elif place1 == "崖边茅庐112":
            txt += "\n【崖边茅庐·屋内】\n你感到一股剑意弥漫！\n极度危险！！！\n★★★进入战斗★★★\n————————————\n【无名剑圣】Lv.80\n◇战斗面板\n◇普攻\n◇技能x\n◇使用x"
            place1 = "崖边茅庐11"
            await battle_initialization("无名剑圣", 80, message, "超能")
 
        
        elif place1 == "破败教会":
            txt += "\n年代无比悠久的建筑，看上去有些残旧。\n其内部传来隐隐约约的庄严气息。\n————————————\n[1] 上前探索"
        elif place1 == "破败教会1":
            txt += "\n【破败教会·内部】\n你走进了教会。\n内部看上去干净整洁，没有外部那般破旧不堪，看样子是有人经常打扫。\n最前方有一座神像，那是生命女神，正散发着莹莹光辉。\n————————————\n[1] “有人吗？”"
        elif place1 == "破败教会11":
            txt += "\n【破败教会·内部】\n“来者何事？”\n神像旁的侧门，一名姿态曼妙的少女缓缓踱入。\n她身着浅绿与纯白交织的华贵礼服，右手持握一杆高过头顶的金柄长杖，二者都散发出一股神圣而又虔诚的威严。\n————————————\n[1] 拜神\n[2] 攻击"
        elif place1 == "破败教会111":
            if player0_data["一转"] != "牧师" or player0_data["等级"] < 30:
                place1 = "破败教会"
                txt += "\n【破败教会·生命天女】\n“真正的信徒已经不多了。”\n————————————\n[0] 离开"
            elif player0_data["剧情任务记录"].get("生命天女_给予试炼", 0) == 0:
                txt += "\n【破败教会·生命天女】\n“女神无条件的给予所有人生机与祝福。”\n“如果你愿意加入教会，你也能够拥有这份虔诚的神力。”\n————————————\n[1] 加入教会"
            elif player0_data["剧情任务记录"].get("生命天女_完成试炼1", 0) == 0:
                txt += "\n【破败教会·生命天女】\n“我来为你治愈~”\n————————————\n[1] 提交试炼"
            elif player0_data["剧情任务记录"].get("生命天女_完成试炼2", 0) == 0:
                txt += "\n【破败教会·生命天女】\n“我来为你治愈~”\n————————————\n[1] 开始/提交试炼"
            elif player0_data["剧情任务记录"].get("生命天女_完成试炼3", 0) == 0:
                txt += "\n【破败教会·生命天女】\n“我来为你治愈~”\n————————————\n[1] 提交试炼"
            else:
                txt += "\n【破败教会·生命天女】\n“还有事吗？”\n————————————\n[1] 新的试炼"
        elif place1 == "破败教会1111":
            
            if player0_data["剧情任务记录"].get("生命天女_给予试炼", 0) == 0:
                place1 = "破败教会111"
                txt += "\n【破败教会·生命天女】\n“想加入教会，首先要考验你的基本功。”\n“我教你一个技能，利用好它去打败两只简简单单的boss吧！”\n“你要时刻注意战场上的变化，及时的支援队友哦！”\n————————————\n★接受任务★\n【讨伐[刺毛猪]】\n【讨伐[纯水精灵]】"
                player0_data["学会技能"].append({"名称": "神圣净化", "等级": 1, "熟练度": 0})
                player0_data["任务"].append({"名称": "神官·试炼1", "来源": "生命天女", "类型": "等阶突破", "目标": [{"类型": "讨伐", "对象": "刺毛猪", "数量": 1, "已讨伐": 0}, {"类型": "讨伐", "对象": "纯水精灵", "数量": 1, "已讨伐": 0}], "奖励": "事件*天女的认可", "剩余时间": "无期限", "编码": 0})
                player0_data["剧情任务记录"]["生命天女_给予试炼"] = 1
                with open(f"data/player/{uid}.txt", 'w') as f:
                    json.dump(player0_data, f, ensure_ascii=False, indent=4)
            elif player0_data["剧情任务记录"].get("生命天女_完成试炼1", 0) == 0:
                place1 = "破败教会111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "神官·试炼1" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【破败教会·生命天女】\n“你还未完成哦！”"
                else:
                    txt += "\n【破败教会·生命天女】\n“嗯，很好”\n“找些队友来吧，我要给予你第二个试炼！”\n————————————\n★接受任务★\n【讨伐[昔日神官]】"
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '神官·试炼1']
                    player0_data["任务"].append({"名称": "神官·试炼2", "来源": "生命天女", "类型": "等阶突破", "目标": [{"类型": "讨伐", "对象": "昔日神官", "数量": 1, "已讨伐": 0}]})
                    player0_data["剧情任务记录"]["生命天女_完成试炼1"] = 1
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
            
            elif player0_data["剧情任务记录"].get("生命天女_完成试炼2", 0) == 0:
                place1 = "破败教会111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "神官·试炼2" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【破败教会·生命天女】\n“准备好了吗？”\n虔诚的气息笼罩！\n★★★进入战斗★★★\n————————————\n【昔日神官】Lv.30\n◇战斗面板\n◇普攻\n◇技能x\n◇使用x"
                    await battle_initialization("昔日神官", 30, message, "神圣")
                else:
                    txt += "\n【破败教会·生命天女】\n“你获得了生命女神的认可。”\n“现在供奉上你的诚意，我便为你洗风接尘。”\n————————————\n★接受任务★\n【收集[石材]*1000】\n【收集[天空碎片]*10】"
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '神官·试炼2']
                    player0_data["任务"].append({"名称": "神官·试炼3", "来源": "生命天女", "类型": "等阶突破", "目标": [{"类型": "收集", "对象": "石材", "数量": 1000}, {"类型": "收集", "对象": "天空碎片", "数量": 10}], "奖励": "事件*转职[神官]", "剩余时间": "无期限", "编码": 0})
                    player0_data["剧情任务记录"]["生命天女_完成试炼2"] = 1
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
            
            elif player0_data["剧情任务记录"].get("生命天女_完成试炼3", 0) == 0:
                place1 = "破败教会111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "神官·试炼3" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【破败教会·生命天女】\n“诚意还不够哦？”"
                else:
                    txt += "\n【破败教会·生命天女】\n“闭上双眼，由我来为你赐福。”\n她高高举起那柄长杖，口中开始浅声的呢喃。\n身后的神像开始挥撒更为耀眼的光芒，一股股浓郁的生命气息涌出，将你全身包裹，无孔不入。\n你察觉到脑海中浮现出庄严的书卷，似乎有神谕在回响。\n“感受到了吧？”\n“你现在同我一样，承担了神的赐福。”\n“愿你将这份爱与责任遍布世间。”\n“变强后再来找我，我会予你更虔诚的赐福。”\n————————————\n★完成试炼★\n【已转职[神官]】"
                    await bag_reduce(uid, "石材", 1000)
                    await bag_reduce(uid, "天空碎片", 10)
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '神官·试炼3']
                    player0_data["剧情任务记录"]["生命天女_完成试炼3"] = 1
                    player0_data["二转"] = "神官"
                    player0_data["学会技能"].append({"名称": "圣天赐福", "等级": 1, "熟练度": 0})
                    player0_data["学会技能"].append({"名称": "神力加持", "等级": 1, "熟练度": 0})
                    txt_明道 = "\n强大的力量充盈着你的体魄。\n你感到压抑已久的枷锁悄然破碎，身躯变得无比轻盈。\n————————————\n【[{}]突破灵阶枷锁】\n————————————\n【等级上限提升！】\n【开化➡明道】".format(player0_data["nickname"])
                    player0_data["装备技能"]["数量"] += 1
                    player0_data["灵阶"] = 4
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
                    asyncio.create_task(send_message(message, 2, 5, txt_明道))
            
            else:
                if player0_data["等级"] < 35:
                    place1 = "破败教会11"
                    txt += "\n【破败教会·生命天女】\n“你现在还太弱小了。”\n————————————\n[0] 离开"

        elif place1 == "破败教会112":
            txt += "\n【破败教会·生命天女】\n肃穆的威严遍布全场！\n极度危险！！！\n★★★进入战斗★★★\n————————————\n【生命天女】Lv.80\n◇战斗面板\n◇普攻\n◇技能x\n◇使用x"
            place1 = "破败教会11"
            await battle_initialization("生命天女", 80, message, "神圣")

        
        elif place1 == "血色神殿":
            txt += "\n高耸入云的巍峨神殿，透露出隐约的神性气息，与此处环境格格不入。\n门口站着两名无比壮硕的人类士兵。\n————————————\n[1] 走近"
        elif place1 == "血色神殿1":
            txt += "\n【血色神殿·门庭】\n“来者止步！”\n看门的士兵伸手阻拦。\n“闲杂人等不得入内！”\n————————————\n[1] 说明来意"
        elif place1 == "血色神殿11":
            txt += "\n【血色神殿·内部】\n“进去吧，不许对主神做无礼之事！”\n你得到允许入内。\n神殿内部很是宽广，宛若黄金铺就的地面，金丝白玉铸就的梁柱，通体宝石打造的吊顶。\n最前方是一座金红色的巨人雕像，与神殿齐高，看上去孔武有力。\n巨人雕像似乎察觉到你的靠近，开始微微挥洒神力。你听到了古老的神语。\n“$^%^%$%^#$&@”\n刚开始你还不懂，下一刻你的脑海中有句话开始回荡。\n“你是来祈福的吗？”\n————————————\n[1] 拜神\n[2] 攻击"
        elif place1 == "血色神殿111":
            if player0_data["一转"] != "牧师" or player0_data["等级"] < 30:
                place1 = "血色神殿"
                txt += "\n【血色神殿·泰坦神像】\n“我无法赐福与你。”\n————————————\n[0] 离开"
            elif player0_data["剧情任务记录"].get("泰坦神像_给予试炼", 0) == 0:
                txt += "\n【血色神殿·泰坦神像】\n“我可以赐福于你。”\n“但相应的，你也会承担上这份赐福的因果。”\n————————————\n[1] 接受赐福"
            elif player0_data["剧情任务记录"].get("泰坦神像_完成试炼1", 0) == 0:
                txt += "\n【血色神殿·泰坦神像】\n“过去多久了。。。”\n————————————\n[1] 提交试炼"
            elif player0_data["剧情任务记录"].get("泰坦神像_完成试炼2", 0) == 0:
                txt += "\n【血色神殿·泰坦神像】\n“准备好。。。”\n————————————\n[1] 开始/提交试炼"
            elif player0_data["剧情任务记录"].get("泰坦神像_完成试炼3", 0) == 0:
                txt += "\n【血色神殿·泰坦神像】\n“收集够了吧。。。”\n————————————\n[1] 提交试炼"
            else:
                txt += "\n【血色神殿·泰坦神像】\n“。。。。。。”\n————————————\n[1] 新的试炼"
        elif place1 == "血色神殿1111":
            
            if player0_data["剧情任务记录"].get("泰坦神像_给予试炼", 0) == 0:
                place1 = "血色神殿111"
                txt += "\n【血色神殿·泰坦神像】\n“要接受我的赐福，我先要考验考验你。”\n“这个技能先交予你，去打败两只常见的生灵吧。”\n“你一定行。”\n————————————\n★接受任务★\n【单挑[刺毛猪]】\n【单挑[纯水精灵]】"
                player0_data["学会技能"].append({"名称": "神躯", "等级": 1, "熟练度": 0})
                player0_data["任务"].append({"名称": "泰坦·试炼1", "来源": "泰坦神像", "类型": "等阶突破", "目标": [{"类型": "单挑", "对象": "刺毛猪", "数量": 1, "已讨伐": 0}, {"类型": "单挑", "对象": "纯水精灵", "数量": 1, "已讨伐": 0}], "奖励": "事件*泰坦的认可", "剩余时间": "无期限", "编码": 0})
                player0_data["剧情任务记录"]["泰坦神像_给予试炼"] = 1
                with open(f"data/player/{uid}.txt", 'w') as f:
                    json.dump(player0_data, f, ensure_ascii=False, indent=4)
            elif player0_data["剧情任务记录"].get("泰坦神像_完成试炼1", 0) == 0:
                place1 = "血色神殿111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "泰坦·试炼1" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【血色神殿·泰坦神像】\n“还不够。”"
                else:
                    txt += "\n【血色神殿·泰坦神像】\n“接下来，你需要打败我的信徒。”\n“他们会限制力量，与你同级对抗。”\n————————————\n★接受任务★\n【单挑[泰坦信徒]】"
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '泰坦·试炼1']
                    player0_data["任务"].append({"名称": "泰坦·试炼2", "来源": "泰坦神像", "类型": "等阶突破", "目标": [{"类型": "单挑", "对象": "泰坦信徒", "数量": 1, "已讨伐": 0}]})
                    player0_data["剧情任务记录"]["泰坦神像_完成试炼1"] = 1
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
            
            elif player0_data["剧情任务记录"].get("泰坦神像_完成试炼2", 0) == 0:
                place1 = "血色神殿111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "泰坦·试炼2" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【血色神殿·泰坦神像】\n“进来吧。”\n沉重的脚步声从殿外传来，一名全副武装的壮硕男子走向了你。\n★★★进入战斗★★★\n————————————\n【泰坦信徒】Lv.30\n◇战斗面板\n◇普攻\n◇技能x\n◇使用x"
                    await battle_initialization("泰坦信徒", 30, message, "稳重")
                else:
                    txt += "\n【血色神殿·泰坦神像】\n“不错，可造之材。”\n“去收集一些血肉吧，我藉此来向你赐福。”\n————————————\n★接受任务★\n【收集[血肉躯壳]*100】\n【收集[能量晶髓]*10】"
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '泰坦·试炼2']
                    player0_data["任务"].append({"名称": "泰坦·试炼3", "来源": "泰坦神像", "类型": "等阶突破", "目标": [{"类型": "收集", "对象": "血肉躯壳", "数量": 100}, {"类型": "收集", "对象": "能量晶髓", "数量": 10}], "奖励": "事件*转职[泰坦]", "剩余时间": "无期限", "编码": 0})
                    player0_data["剧情任务记录"]["泰坦神像_完成试炼2"] = 1
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
            
            elif player0_data["剧情任务记录"].get("泰坦神像_完成试炼3", 0) == 0:
                place1 = "血色神殿111"
                task_ok = True
                for task in player0_data["任务"]:
                    if task["名称"] == "泰坦·试炼3" and task["类型"] == "等阶突破":
                        for task0 in task["目标"]:
                            if task0["类型"] == "收集":
                                if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                                    task_ok = False
                            if task0["类型"] == "讨伐" or task0["类型"] == "单挑":
                                if int(task0["已讨伐"]) <  int(task0["数量"]):
                                    task_ok = False
                        break
                if not task_ok:
                    txt += "\n【血色神殿·泰坦神像】\n“嗯。还不够。。。”"
                else:
                    txt += "\n【血色神殿·泰坦神像】\n“可以了，接受我的祝福吧。”\n神像发出耀目的光彩，宛若神迹。\n面前那堆血肉变成了精粹的能量，修补着你的身体。你察觉到身躯被逐渐的的强化。\n持续了好一会儿才结束。\n“如何？”\n“相比之前而言，是不是感觉有力了不少？”\n“你接受了这份因果，以后自然会接触真相。”\n“变强后再来找我，我会助你更好的前行。”\n————————————\n★完成试炼★\n【已转职[泰坦]】"
                    await bag_reduce(uid, "血肉躯壳", 100)
                    await bag_reduce(uid, "能量晶髓", 10)
                    player0_data["任务"] = [task for task in player0_data["任务"] if task['名称'] != '泰坦·试炼3']
                    player0_data["剧情任务记录"]["泰坦神像_完成试炼3"] = 1
                    player0_data["二转"] = "泰坦"
                    player0_data["学会技能"].append({"名称": "巨人身躯", "等级": 1, "熟练度": 0})
                    player0_data["学会技能"].append({"名称": "古神血脉", "等级": 1, "熟练度": 0})
                    txt_明道 = "\n强大的力量充盈着你的体魄。\n你感到压抑已久的枷锁悄然破碎，身躯变得无比轻盈。\n————————————\n【[{}]突破灵阶枷锁】\n————————————\n【等级上限提升！】\n【开化➡明道】".format(player0_data["nickname"])
                    player0_data["装备技能"]["数量"] += 1
                    player0_data["灵阶"] = 4
                    with open(f"data/player/{uid}.txt", 'w') as f:
                        json.dump(player0_data, f, ensure_ascii=False, indent=4)
                    asyncio.create_task(send_message(message, 2, 5, txt_明道))
            
            else:
                if player0_data["等级"] < 35:
                    place1 = "血色神殿11"
                    txt += "\n【血色神殿·泰坦神像】\n“你现在还太弱小了。”\n————————————\n[0] 离开"

        elif place1 == "血色神殿112":
            txt += "\n【血色神殿·泰坦神像】\n神殿变成猩红色！\n极度危险！！！\n★★★进入战斗★★★\n————————————\n【泰坦神像】Lv.80\n◇战斗面板\n◇普攻\n◇技能x\n◇使用x"
            place1 = "血色神殿11"
            await battle_initialization("泰坦神像", 80, message, "血腥")


        elif place1 == "破败教会":
            txt += "\n。。。。。。\n————————————\n[1] 上前探索"
        elif place1 == "罪恶王冠":
            txt += "\n。。。。。。\n————————————\n[1] 上前探索"
        else:
            if_npc_action = False

        if if_npc_action:
            await txt_write("player", "number", number, "地名", place1)
            await send_message(message, 0, 1, txt)
        else:
            return
        return

        

    if_write = True
    try:
        with open(f"data/map/{place}.txt", 'r') as f:
            data = json.load(f)
    except FileNotFoundError:
        if_write = False
        await send_message(message, 0, 1, txt)
        return




    if place == "世界树":
        
        txt += "\n————————————\n【大陆枢纽•世界树】\n盘根错节，舞蛟苍虬。\n脉络亘撒，窥古通今。\n琼枝弄顶，问津寥人。\n枝繁花茂，脍炙众生。\n◈[1] 前往世界树底层\n◈[2] 前往世界树中层\n◈[3] 前往世界树上层\n◈[4] 前往世界树顶层\n◈[5] 前往世界树地下\n————————————\n发送[1][2][3][4][5]进行操作"
        await send_message(message, 0, 1, txt, "https://tse1-mm.cn.bing.net/th/id/OIP-C.sw-V8a4ew0KR_O-SzAh97gHaEG?rs=1&pid=ImgDetMain")
        return

    



    with open("data/boss_locate.txt", 'r') as f:
        boss_data = json.load(f)
    for boss_item in boss_data:
        if boss_item["位置"] == player_item["地名"] and boss_item["存活"] == "是":
            if boss_item["当前"]["x"] == x and boss_item["当前"]["y"] == y:
                txt += "\n★★★BOSS遇战★★★\n————————————\n【{}】Lv.{}\n◇战斗面板\n◇普攻\n◇技能x\n◇使用x".format(boss_item["名称"], boss_item["等级"])
                await send_message(message, 0, 1, txt)
                await battle_initialization(boss_item["名称"], boss_item["等级"], message, "随机大")
                return
            if boss_item["当前"]["x"] < x:
                where1 = "[左]"
            elif boss_item["当前"]["x"] > x:
                where1 = "[右]"
            else:
                where1 = ""
            if boss_item["当前"]["y"] < y:
                where2 = "[下]"
            elif boss_item["当前"]["y"] > y:
                where2 = "[上]"
            else:
                where2 = ""
            distance = abs(boss_item["当前"]["x"] - x) + abs(boss_item["当前"]["y"] - y)
            if distance <= 5:
                distance = "极近"
            elif distance > 5 and distance <= 10:
                distance = "很近"
            elif distance > 10 and distance <= 15:
                distance = "近"
            elif distance > 15 and distance <= 25:
                distance = "远"
            elif distance > 25 and distance <= 50:
                distance = "很远"
            elif distance > 50 and distance <= 100:
                distance = "极远"
            elif distance > 100:
                continue

            txt += "\n✡魔力感知 {}{}方向({})\n➥{}".format(where1, where2, distance, boss_item["提示"])

        
    if if_write:
        total_prob = 0
        for event in data:
            total_prob += data[event]["概率"]
        random_num = random.uniform(0, total_prob)
        for event in data:
            random_num -= data[event]["概率"]
            if random_num <= 0:
                break
        if event == "遇战":
            
            monsters = data["遇战"]["内容"]
            
            """哥布林特殊标记机制"""
            biaoji = await player_read(number, "特殊效果")
            biaoji0 = 0
            for biao in biaoji:
                if "标记*哥布林标记" in biao:
                    biaoji0 = int(biao.split("*")[2])
            if biaoji0 > 0 and place == "幽暗密林深处":
                for item in monsters:
                    if item["概率"] <= 10:
                        if biaoji0 >= 50:
                            item["概率"] = biaoji0 * 1000
                        elif biaoji0 >= 25:
                            item["概率"] = biaoji0 * 200
                        elif biaoji0 >= 12:
                            item["概率"] = biaoji0 * 40
                        elif biaoji0 >= 5:
                            item["概率"] = biaoji0 * 10
                    elif item["概率"] <= 20:
                        if biaoji0 >= 50:
                            item["概率"] = 1
                        elif biaoji0 >= 25:
                            item["概率"] *= biaoji0 * 40
                        elif biaoji0 >= 12:
                            item["概率"] *= biaoji0 * 20
                        elif biaoji0 >= 5:
                            item["概率"] *= biaoji0 * 5
                    elif item["概率"] <= 100:
                        if biaoji0 >= 50:
                            item["概率"] = 1
                        elif biaoji0 >= 25:
                            item["概率"] *= biaoji0 * 4
                        elif biaoji0 >= 12:
                            item["概率"] *= biaoji0 * 40
                        elif biaoji0 >= 5:
                            item["概率"] *= biaoji0 * 4
                    elif item["概率"] <= 2000:
                        if biaoji0 >= 50:
                            item["概率"] = 1
                        elif biaoji0 >= 25:
                            item["概率"] += biaoji0 * 10
                        elif biaoji0 >= 12:
                            item["概率"] += biaoji0 * 100
                        elif biaoji0 >= 5:
                            item["概率"] += biaoji0 * 1000

            total_prob = sum(monster["概率"] for monster in monsters)
            rand_num = random.randint(1, total_prob)
            for item in monsters:
                if rand_num <= item["概率"]:
                    monster = item["名称"]
                    say = item["描述"]
                    if say:
                        say = random.choice(item["描述"])
                        say = say.replace("\\n", "\n")
                    else:
                        say = ""
                    level_min = int(item["等级"].split("-")[0])
                    level_max = int(item["等级"].split("-")[1])
                    level = random.randint(level_min, level_max)
                    break
                rand_num -= item["概率"]
            

            
            txt += "\n{}\n————————————\n⚔遇战⚔【{}】Lv.{}\n◇战斗面板\n◇普攻\n◇技能x\n◇道具x(制作中)".format(say, monster, level)

            await send_message(message, 0, 1, txt)
            await battle_initialization(monster, level, message, "随机小")
            return

        elif event == "事件":

            total_prob = sum(item['概率'] for item in data["事件"]["内容"])
            random_num = random.randint(1, total_prob)
            say = ""
            for item in data["事件"]["内容"]:
                if random_num <= item['概率']:
                    reward = item["奖励"]
                    say = item["描述"]
                    break
                random_num -= item["概率"]
            txt += "\n————————————\n※事件※\n◈{}".format(say)
            if int(await player_read(number, "体力")) <= 0:
                txt += "\n◈你过度疲惫，难以再回应世界的馈赠"
                await send_message(message, 0, 1, txt)
                return
            for rewar in reward:

                if "经验" in rewar:
                    uid = await player_id(number)
                    name = await player_name(uid)
                    exp_add = int(rewar.split("验")[1])
                    txt += "\n◈【{}】EXP+{}".format(name, exp_add)
                    exp_now = await player_read(number, "经验", "当前")
                    exp_now += exp_add
                    level = await player_read(number, "等级")
                    exp_max = await exp_up(level)
                    while exp_now >= exp_max:
                        level_max = int(await player_read(number, "灵阶")) * 10
                        if int(level) >= level_max:
                            exp_now = exp_max
                            txt += "\n◈精纯的能量冲入你的体壳，然后向外四溢，消散在了空中。。。"
                            break
                        point = await player_read(number, "属性点") + 1
                        await player_write(number, "属性点", None, point)
                        exp_now -= exp_max
                        level += 1
                        exp_max = await exp_up(level)
                        txt += "\n◈【{}】升到{}级\n获得属性点，可以[属性分配]".format(name, level)


                        """进化机制"""
                        if int(await player_read(number, "灵阶")) == 3:
                            with open(f"data/进化词条.txt", 'r') as f:
                                evolute = json.load(f)
                            random_evolute = random.choice(evolute)
                            player_evolute = await player_read(number, "进化")
                            while True:
                                count = 0
                                for every_evolute in player_evolute:
                                    if every_evolute["部位"] == random_evolute["部位"]:
                                        if random_evolute["词条"] == every_evolute["词条"]:
                                            random_evolute = random.choice(evolute)
                                            break
                                        else:
                                            count += 1
                                else:
                                    break
                            if count >= 5:
                                evolute_percent = 0
                            else:
                                evolute_percent = 0.5 ** (count - 1)
                            if random.random() < evolute_percent:
                                num_range = random_evolute["数值"].split("-")
                                num_min = float(num_range[0])
                                num_max = float(num_range[1])
                                random_num = round(random.uniform(num_min, num_max), 2)
                                random_evolute["数值"] = random_num
                                player_evolute.append(random_evolute)

                                await player_write(number, "进化", None, player_evolute)

                            if random.random() < 0.75:
                                player_unevolute = await player_read(number, "进化诅咒")
                                with open(f"data/进化诅咒.txt", 'r') as f:
                                    unevolute = json.load(f)
                                unevolute = [d for d in unevolute if d['部位'] == random_evolute["部位"]]
                                random_unevolute = random.choice(unevolute)
                                while True:
                                    count = 0
                                    for every_unevolute in player_unevolute:
                                        if random_unevolute["部位"] == every_unevolute["部位"]:
                                            if random_unevolute["词条"] == every_unevolute["词条"]:
                                                random_unevolute = random.choice(unevolute)
                                                break
                                            else:
                                                count += 1
                                    else:
                                        break
                                if count < 4:
                                    num_range = random_unevolute["数值"].split("-")
                                    num_min = float(num_range[0])
                                    num_max = float(num_range[1])
                                    random_num = round(random.uniform(num_min, num_max), 2)
                                    random_unevolute["数值"] = random_num
                                    player_unevolute.append(random_unevolute)

                                    await player_write(number, "进化诅咒", None, player_unevolute)

                        """进化机制"""


                    await player_write(number, "经验", "当前", exp_now)
                    await player_write(number, "经验", "最大", exp_max)
                    await player_write(number, "等级", None, level)
                    power = int(await player_read(number, "体力")) - 1
                    await player_write(number, "体力", None, power)

                elif "*" in rewar:

                    uid = await player_id(number)
                    name = await player_name(uid)
                    thing = rewar.split("*")[0]
                    num = int(rewar.split("*")[1])
                    await bag_add(uid, thing, num)
                    txt += "\n◈【{}】获得物品[{}]×{}".format(name, thing, num)

            await send_message(message, 0, 1, txt)
            return

        elif event == "商店":

            total_prob = sum(item['概率'] for item in data["商店"]["内容"])
            random_num = random.randint(1, total_prob)
            say = ""
            for item in data["商店"]["内容"]:
                if random_num <= item['概率']:
                    shop = item["名称"]
                    say = item["话语"]
                    break
                random_num -= item["概率"]
            if shop == "普通商人":
                txt += "\n————————————\n※商店※\n◈“{}”\n".format(say)
                with open(f"data/shop/{place}.txt", 'r') as f:
                    shop_data = json.load(f)
                for x, shop_item in enumerate(shop_data["当前"]):
                    shop_id = x + 1
                    txt += "\n【{}】{} (剩余:{})\n   单价：{}铜币".format(shop_id, shop_item["名称"], shop_item["数量"], shop_item["单个价格"])
                txt += "\n————————————\n【发送[购买 名称*数量]进行购买】\n【示例 [购买小血瓶*10]】\n【发送[离开商店]离开】"
                await txt_write("player", "number", number, "状态", "野外商店")
            if shop == "神秘商人":
                txt += "\n————————————\n※神秘商店※\n◈“{}”\n".format(say)
                with open(f"data/shop/{place}神秘商店.txt", 'r') as f:
                    shop_data = json.load(f)
                for x, shop_item in enumerate(shop_data["当前"]):
                    shop_id = x + 1
                    txt += "\n【{}】{} (剩余:{})\n   单价：{}{}".format(shop_id, shop_item["名称"], shop_item["数量"], shop_item["单个价格"], shop_item["货币类型"])
                txt += "\n————————————\n【发送[购买 名称*数量]进行购买】\n【示例 [购买小血瓶*10]】\n【发送[离开商店]离开】"
                await txt_write("player", "number", number, "状态", "野外神秘商店")
            await send_message(message, 0, 1, txt)
            return


async def shop_sell(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    sell_thing = message.content.split("出售")[1]
    sell_thing_split = sell_thing.split("*")
    if len(sell_thing_split) == 1:
        thing_name = sell_thing_split[0]
        thing_number = 1
    elif len(sell_thing_split) == 2:
        thing_name = sell_thing_split[0]
        try:
            thing_number = int(sell_thing_split[1])
        except ValueError:
            txt = "\n【数量输入错误！】"
            await send_message(message, 0, 1, txt)
            return
    
    if_enough = await bag_enough(uid, thing_name, thing_number)
    if "不够" in if_enough:
        lack_number = if_enough.split("缺")[1]
        txt = "\n【你没有足够的[{}]！】\n◈缺少[{}] × {}".format(thing_name, thing_name, thing_number)
        await send_message(message, 0, 1, txt)
        return
    elif if_enough == "够了":
        price = await sell_price(thing_name)
        if price == "不存在":
            txt = "\n【[{}]不可出售！】".format(thing_name)
            await send_message(message, 0, 1, txt)
            return
        else:
            all_price = price * thing_number
            await bag_reduce(uid, thing_name, thing_number)
            await bag_add(uid, "铜币", all_price)
            txt = "\n【你出售了[{}] × {}】\n◈获得{}铜币".format(thing_name, thing_number, all_price)
            await send_message(message, 0, 1, txt)
            return
    

async def shop_buy(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    buy_thing = message.content.split("购买")[1]
    buy_thing_split = buy_thing.split("*")
    if len(buy_thing_split) == 1:
        thing_name = buy_thing_split[0]
        thing_number = 1
    elif len(buy_thing_split) == 2:
        thing_name = buy_thing_split[0]
        try:
            thing_number = int(buy_thing_split[1])
        except ValueError:
            txt = "\n【数量输入错误！】"
            await send_message(message, 0, 1, txt)
            return
    place = await txt_exist("player", "number", number, "地名")
    state = await txt_exist("player", "number", number, "状态")
    if place == "世界树122":
        if_tree = True
        with open(f"data/shop/铁匠铺商店.txt", 'r') as f:
            shop_data = json.load(f)
    elif place == "世界树132":
        if_tree = True
        with open(f"data/shop/炼金所商店.txt", 'r') as f:
            shop_data = json.load(f)
    elif place == "世界树142":
        if_tree = True
        with open(f"data/shop/分解屋商店.txt", 'r') as f:
            shop_data = json.load(f)
    elif state == "野外商店":
        if_tree = False
        with open(f"data/shop/{place}.txt", 'r') as f:
            shop_data = json.load(f)
    elif state == "野外神秘商店":
        if_tree = False
        with open(f"data/shop/{place}神秘商店.txt", 'r') as f:
            shop_data = json.load(f)
    found = False
    for shop_item in shop_data["当前"]:
        if shop_item["名称"] == thing_name:
            found = True
            shop_price = shop_item["单个价格"]
            shop_number = shop_item["数量"]
            shop_money = shop_item.get("货币类型", "铜币")
            break
    if not found:
        txt = "\n【本店不卖[{}]！】\n————————————".format(thing_name)
        for x, shop_item in enumerate(shop_data["当前"]):
            shop_id = x + 1
            shop_money = shop_item.get("货币类型", "铜币")
            txt += "\n【{}】{} (剩余:{})\n   单价：[{}]{}".format(shop_id, shop_item["名称"], shop_item["数量"], shop_item["单个价格"], shop_money)
        txt += "\n————————————\n【发送[购买 名称*数量]进行购买】\n【示例 [购买大血瓶*99]】\n【发送[离开商店]离开】"
        await send_message(message, 0, 1, txt)
        return
    if shop_number < thing_number:
        txt = "\n【仅剩[{}] × {}！】\n————————————".format(thing_name, shop_number)
        for x, shop_item in enumerate(shop_data["当前"]):
            shop_id = x + 1
            txt += "\n【{}】{} (剩余:{})\n   单价：[{}]{}".format(shop_id, shop_item["名称"], shop_item["数量"], shop_item["单个价格"], shop_money)
        txt += "\n————————————\n【发送[购买 名称*数量]进行购买】\n【示例 [购买大血瓶*99]】\n【发送[离开商店]离开】"
        await send_message(message, 0, 1, txt)
        return
    all_price = shop_price * thing_number
    if_enough = await bag_enough(uid, shop_money, all_price)
    if "不够" in if_enough:
        lack_number = if_enough.split("缺")[1]
        txt = "\n【你没有足够的{}！】\n◈缺少[{}]{}".format(shop_money, lack_number, shop_money)
        await send_message(message, 0, 1, txt)
        return
    elif if_enough == "够了":
        await bag_reduce(uid, shop_money, all_price)
        await bag_add(uid, thing_name, thing_number)
        if not if_tree:
            shop_item["数量"] -= thing_number
            if shop_item["数量"] <= 0:
                shop_data["当前"].remove(shop_item)
            if state == "野外商店":
                with open(f"data/shop/{place}.txt", 'w') as f:
                    json.dump(shop_data, f, ensure_ascii=False, indent=4)
            if state == "野外神秘商店":
                with open(f"data/shop/{place}神秘商店.txt", 'w') as f:
                    json.dump(shop_data, f, ensure_ascii=False, indent=4)

        txt = "\n【你购买了[{}] × {}】\n◈消费了[{}]{}".format(thing_name, thing_number, all_price, shop_money)
        await send_message(message, 0, 1, txt)
        return


async def guild_shop(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    with open(f"data/shop/公会商店.txt", 'r') as f:
        shop_data = json.load(f)
    txt = "\n【冒险家公会•兑换商店】\n『吉祥物·猫猫』\n(灬ºωº灬)\n“冒险家大人，您需要些什么呢？”\n————————————"
    for x, shop_item in enumerate(shop_data["当前"]):
        shop_id = x + 1
        txt += "\n【{}】{} (剩余:{})\n   单价：[{}]{}".format(shop_id, shop_item["名称"], shop_item["数量"], shop_item["单个价格"], shop_item["货币类型"])
    txt += "\n————————————\n【发送[购买 名称*数量]进行购买】\n【示例 [购买猫猫*99]】\n【发送[离开商店]离开】"
    await send_message(message, 0, 1, txt)
    return


async def guild_shop_buy(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    buy_thing = message.content.split("购买")[1]
    buy_thing_split = buy_thing.split("*")
    if len(buy_thing_split) == 1:
        thing_name = buy_thing_split[0]
        thing_number = 1
    elif len(buy_thing_split) == 2:
        thing_name = buy_thing_split[0]
        try:
            thing_number = int(buy_thing_split[1])
        except ValueError:
            txt = "\n【数量输入错误！】"
            await send_message(message, 0, 1, txt)
            return
    with open(f"data/shop/公会商店.txt", 'r') as f:
        shop_data = json.load(f)
    found = False
    for shop_item in shop_data["当前"]:
        if shop_item["名称"] == thing_name:
            found = True
            shop_price = shop_item["单个价格"]
            shop_number = shop_item["数量"]
            shop_money = shop_item.get("货币类型", "铜币")
            break
    if not found:
        txt = "\n【冒险家公会•兑换商店】\n『吉祥物·猫猫』\n(・`ω´・)\n“这里可没有卖[{}]的~”\n“你拿猫猫寻开心呢！”\n“挠你挠你挠你挠你~”\n————————————\n【发送[公会商店]查看详情】\n【发送[离开商店]离开】".format(thing_name)
        await send_message(message, 0, 1, txt)
        return
    if shop_number < thing_number:
        txt = "\n【冒险家公会•兑换商店】\n『吉祥物·猫猫』\n(｡•ㅅ•｡)♡\n“[{}]数量不够了耶~”\n“猫猫会通知公会管理员去补货的！”\n“快表扬表扬我吧~”\n————————————\n【发送[公会商店]查看详情】\n【发送[离开商店]离开】".format(thing_name)
        await send_message(message, 0, 1, txt)
        return
    all_price = shop_price * thing_number
    if_enough = await bag_enough(uid, shop_money, all_price)
    if "不够" in if_enough:
        lack_number = if_enough.split("缺")[1]
        txt = "\n【冒险家公会•兑换商店】\n『吉祥物·猫猫』\n:;(∩´﹏`∩);:\n“一共需要[{}]个[{}]~”\n“冒险家大人，您的代币好像不足呢。。。”\n“猫猫可不能白送你，不然要被会长打屁股的”\n————————————\n【发送[公会商店]查看详情】\n【发送[离开商店]离开】".format(all_price, shop_money)
        await send_message(message, 0, 1, txt)
        return
    elif if_enough == "够了":
        await bag_reduce(uid, shop_money, all_price)
        await bag_add(uid, thing_name, thing_number)

        txt = "\n【冒险家公会•兑换商店】\n『吉祥物·猫猫』\n(,,・ω・,,)\n“谢谢惠顾，一共消费[{}]个[{}]~”\n“这是您的[{}]个[{}]，要装好了哟~”\n“猫猫期待着您的下次光临！”\n————————————\n【发送[公会商店]查看详情】\n【发送[离开商店]离开】".format(all_price, shop_money, thing_number, thing_name)
        await send_message(message, 0, 1, txt)
        return






async def equip(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    equip_name = message.content.split("装备")[1]
    with open(f"data/bag/{uid}.txt", 'r') as f:
        data = json.load(f)
        have_equip = False
        guanming = False
        if "·" in equip_name:
            true_equip_name = equip_name.split("·")[0]
            guanming = True
        else:
            true_equip_name = equip_name
        for item in data['背包']:
            item_name = item['名称'].split("+")[0]
            if item_name == equip_name:
                whole_equip_name = item['名称']
                item['数量'] = int(item['数量']) - 1
                if item['数量'] <= 0:
                    data['背包'].remove(item)
                have_equip = True
                break

        if not have_equip:
            txt = "\n你背包中不存在[{}]".format(equip_name)
            await send_message(message, 0, 1, txt)
            return
        
        #如果背包有装备
        if have_equip:
            if not os.path.exists(f"data/equipment/{true_equip_name}.txt"):
                txt = "\n【[{}]不可装备！】".format(true_equip_name)
                await send_message(message, 0, 1, txt)
                return
            with open(f"data/equipment/{true_equip_name}.txt", 'r') as f:
                data1 = json.load(f)
                equip_part = data1["部位"]
            now_equip = data["装备"][equip_part]
            now_equip_bag = False
            
            #脱下现在穿的装备
            if now_equip:
                for item in data['背包']:
                    if item['名称'] == now_equip:
                        item['数量'] = int(item['数量']) + 1
                        now_equip_bag = True
                        break
                if not now_equip_bag:
                    data['背包'].append({'名称': now_equip, '数量': 1})
            
            #要穿的装备
            data["装备"][equip_part] = whole_equip_name
            
        with open(f"data/bag/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        await attribute_count(message)
        txt = "\n【你装备了[{}]】".format(equip_name)
        if guanming:
            txt += "\n  🔨"
            equip_add_split = whole_equip_name.split("=")[1]
            properties = equip_add_split.strip('&').split('&')
            for prop in properties:
                name, value = prop.split('*')
                txt += "[{}+{}]".format(name, value)
 


        txt_effect = ""
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        effect = data["特殊效果"]
        if "装备*轻甲穿着" in effect:
            txt_effect += "\n『轻甲穿着』增加[25*等级]点速闪\n最大魔力+25% 闪避+25% 速度+25%"
        if "装备*轻甲武装" in effect:
            txt_effect += "\n『轻甲武装』增加[50*等级]点速闪\n最大魔力+45% 闪避+45% 速度+45%"
        if "装备*中甲穿着" in effect:
            txt_effect += "\n『中甲穿着』增加[25*等级]点双暴\n最大生命+10% 最大魔力+10% 暴击+25% 暴伤+25%"
        if "装备*中甲武装" in effect:
            txt_effect += "\n『中甲武装』增加[50*等级]点双暴\n最大生命+18% 最大魔力+18% 暴击+45% 暴伤+45%"
        if "装备*重甲穿着" in effect:
            txt_effect += "\n『重甲穿着』增加[25*等级]点双抗\n最大生命+20% 暴免+20% 暴抗+20% 韧性+20%"
        if "装备*重甲武装" in effect:
            txt_effect += "\n『重甲武装』增加[50*等级]点双抗\n最大生命+35% 暴免+35% 暴抗+35% 韧性+35%"
        if "装备*若有若无的回音" in effect:
            txt_effect += "\n『若有若无的回音』全属性提升2%"
        if "装备*清晰悦耳的音符" in effect:
            txt_effect += "\n『清晰悦耳的音符』全属性提升5%"
        if "装备*周天流转的旋律" in effect:
            txt_effect += "\n『周天流转的旋律』全属性提升8%"
        if "装备*婉转回旋的独唱" in effect:
            txt_effect += "\n『婉转回旋的独唱』全属性提升12%"
        if "装备*独步天籁的绝响" in effect:
            txt_effect += "\n『独步天籁的绝响』全属性提升15%"
        if "装备*破法Ⅰ" in effect:
            txt_effect += "\n『破法Ⅰ』魔法穿透提升10%"
        if "装备*破法Ⅱ" in effect:
            txt_effect += "\n『破法Ⅱ』魔法穿透提升20%"
        if "装备*破法Ⅲ" in effect:
            txt_effect += "\n『破法Ⅲ』魔法穿透提升30%"
        if "装备*反震Ⅰ" in effect:
            txt_effect += "\n『反震Ⅰ』物理反伤15%"
        if "装备*反震Ⅱ" in effect:
            txt_effect += "\n『反震Ⅱ』物理反伤30%"
        if "装备*反震Ⅲ" in effect:
            txt_effect += "\n『反震Ⅲ』物理反伤50%"
        if "装备*治疗提升Ⅰ" in effect:
            txt_effect += "\n『治疗提升Ⅰ』治疗量提升20%"
        if "装备*伤害加深Ⅰ" in effect:
            txt_effect += "\n『伤害加深Ⅰ』最终伤害提升10%"
        if "装备*邪视" in effect:
            txt_effect += "\n『邪视』将魔攻1:0.5转化为物攻。\n所有攻击伤害转变为暗属性魔法伤害。"
        if "装备*诅咒" in effect:
            txt_effect += "\n『诅咒』每回合给予敌人‘诅咒’状态，降低全属性"
        if "装备*黎明" in effect:
            txt_effect += "\n『黎明』每回合将获得黎明的祝福"
        if "装备*撕裂" in effect:
            txt_effect += "\n『撕裂』每次攻击给予敌人‘撕裂’状态，降低双防"
        if "装备*嗜血" in effect:
            txt_effect += "\n『嗜血』伤害汲取增加25%"
        if "装备*山崩" in effect:
            txt_effect += "\n『山崩』受到伤害时，一定概率反弹真实伤害"
        if "装备*光附魔" in effect:
            txt_effect += "\n『光附魔』所有攻击转变为光属性。\n光属性伤害提升10%。"
        if "装备*暗附魔" in effect:
            txt_effect += "\n『暗附魔』所有攻击转变为暗属性。\n暗属性伤害提升10%。"
        if "装备*史史史" in effect:
            txt_effect += "\n『史史史』战斗时，为你召唤一只小史莱姆！"
        if "装备*献爱心" in effect:
            txt_effect += "\n『献爱心』为全队增加爱的经验！"
        

    
        txt += "\n✪当前装备效果：{}".format(txt_effect)

        await send_message(message, 0, 1, txt)
        return



async def make_thing(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    txt = ""
    uid = await player_id(number)
    thing_message = message.content.split("制作")[1]
    make0 = thing_message.split("*")
    if len(make0) == 1:
        make_name = thing_message
        make_number = 1
        make_use = 0
    elif len(make0) == 2:
        make_name = make0[0]
        make_number = int(make0[1])
        make_use = 0
    elif len(make0) == 3:
        make_name = make0[0]
        make_number = int(make0[1])
        make_use = int(make0[2]) - 1
    if make_name:
        found = False
        with open("data/make.txt", 'r') as f:
            data = json.load(f)
        with open(f"data/bag/{uid}.txt", 'r') as f:
            bag_data = json.load(f)
        for item in data:
            if item["名称"] == make_name:
                found = True
                can_make = True
                for key, value in item["配方"][make_use].items():
                    need_name = key
                    need_number = int(value) * make_number
                    bag_has = False
                    bag_enough = False
                    for bag_item in bag_data["背包"]:
                        if bag_item["名称"] == need_name and int(bag_item["数量"]) >= need_number:
                            bag_item["数量"] = int(bag_item["数量"]) - need_number
                            bag_has = True
                            bag_enough = True
                            if bag_item["数量"] == 0:
                                bag_data["背包"].remove(bag_item)
                            break
                        elif bag_item["名称"] == need_name and bag_item["数量"] < need_number:
                            want_name = need_name
                            want_number = int(need_number - bag_item["数量"])
                            txt += "\n缺少[{}] ×{}".format(want_name, want_number)
                            bag_has = True
                            bag_enough = False
                            can_make = False
                            break
                    if not bag_has:
                        can_make = False
                        want_name = need_name
                        want_number = int(need_number)
                        txt += "\n缺少[{}] × {}".format(want_name, want_number)
                if not can_make:
                    await send_message(message, 0, 1, txt)
                    return
                elif can_make:
                    find = False
                    for bag_item in bag_data["背包"]:
                        if bag_item["名称"] == make_name:
                            find = True
                            bag_item["数量"] = int(bag_item["数量"]) + make_number
                            break
                    if not find:
                        bag_data["背包"].append({"名称": make_name, "数量": make_number})
                    with open(f"data/bag/{uid}.txt", 'w') as f:
                        json.dump(bag_data, f, ensure_ascii=False, indent=4)
                    txt += "\n【你制作了[{}] × {}】".format(make_name, make_number)
                    await send_message(message, 0, 1, txt)
                    return


async def resolve_thing(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    play_name = await player_name(uid)
    resolve0 = message.content.split("分解")[1]
    resolve1 = resolve0.split("*")
    if len(resolve1) == 1:
        resolve_name = resolve1[0]
        resolve_number = 1
    elif len(resolve1) == 2:
        resolve_name = resolve0.split("*")[0]
        resolve_number = int(resolve0.split("*")[1])
    enough_return = await bag_enough(uid, resolve_name, resolve_number)
    if "不够" in enough_return:
        txt = "\n【你没有足够的[{}]！】".format(resolve_name)
        await send_message(message, 0, 1, txt)
        return
    
    jobs = await player_read(number, "副职业", None)
    if not any(job["副职业"] == "分解师" for job in jobs):
        if_job = False
    else:
        if_job = True
        job_level = int([job["等级"] for job in jobs if job["副职业"] == "分解师"][0])
    found = False
    with open(f"data/必备_resolve.txt", 'r') as f:
        resolve_data = json.load(f)
    if resolve_name in resolve_data:
        resolve_thing = {}
        for i in range(resolve_number):
            for resolve_item in resolve_data[resolve_name]["普通"]:
                resolve_result = resolve_item.split("*")
                resolve_result_name = resolve_result[0]
                resolve_result_number = resolve_result[1]
                resolve_result_percent = float(resolve_result[2])
                random_float = random.uniform(0, 100)
                if if_job:
                    resolve_result_percent = resolve_result_percent * (1 + job_level * 0.02)
                if random_float > resolve_result_percent:
                    continue
                if "-" in resolve_result_number:
                    resolve_result_number_min = int(resolve_result_number.split("-")[0])
                    resolve_result_number_max = int(resolve_result_number.split("-")[1])
                    resolve_result_number = random.randint(resolve_result_number_min, resolve_result_number_max)
                    if if_job:
                        resolve_result_number = int(resolve_result_number * (1 + job_level * 0.02))
                else:
                    resolve_result_number = int(resolve_result_number)
                if resolve_result_name in resolve_thing:
                    resolve_thing[resolve_result_name] += resolve_result_number
                else:
                    resolve_thing[resolve_result_name] = resolve_result_number
            if if_job:
                for resolve_item in resolve_data[resolve_name]["特殊"]:
                    resolve_result = resolve_item.split("*")
                    resolve_result_name = resolve_result[0]
                    resolve_result_number = resolve_result[1]
                    resolve_result_percent = float(resolve_result[2])
                    random_float = random.uniform(0, 100)
                    if if_job:
                        resolve_result_percent = resolve_result_percent * (1 + job_level * 0.02)
                    if random_float > resolve_result_percent:
                        continue
                    if "-" in resolve_result_number:
                        resolve_result_number_min = int(resolve_result_number.split("-")[0])
                        resolve_result_number_max = int(resolve_result_number.split("-")[1])
                        resolve_result_number = random.randint(resolve_result_number_min, resolve_result_number_max)
                        if if_job:
                            resolve_result_number = int(resolve_result_number * (1 + job_level * 0.02))
                    else:
                        resolve_result_number = int(resolve_result_number)
                    if resolve_result_name in resolve_thing:
                        resolve_thing[resolve_result_name] += resolve_result_number
                    else:
                        resolve_thing[resolve_result_name] = resolve_result_number

        await bag_reduce(uid, resolve_name, resolve_number)
        if if_job:
            txt = "\n【🪚你分解了[{}] × {}】\n得到：".format(resolve_name, resolve_number)
        else:
            txt = "\n【你分解了[{}] × {}】\n得到：".format(resolve_name, resolve_number)
        for result_name, result_number in resolve_thing.items():
            if result_number == 0:
                continue
            txt += "\n[{}] × {}".format(result_name, result_number)
            await bag_add(uid, result_name, result_number)
        if if_job:
            for job in jobs:
                if job["副职业"] == "分解师":
                    get_exp = int(resolve_number)
                    if get_exp > job["精力"]:
                        get_exp = job["精力"]
                    job["熟练度"] = int(job["熟练度"] + get_exp)
                    job["精力"] = int(job["精力"] - get_exp)
                    exp_list = [100, 400, 1500, 2500, 4500, 8000, 15000, 40000, 100000, 600000, 9999999999]
                    job["熟练度上限"] = exp_list[job["等级"]]
                    if job["熟练度"] >= job["熟练度上限"]:
                        job["等级"] += 1
                        job["熟练度"] -= job["熟练度上限"]
                        job["熟练度上限"] = exp_list[job["等级"]]
                        energy_max = [200, 400, 600, 800, 1000, 1500, 2000, 3000, 4000, 5000, 0]
                        job["精力上限"] = energy_max[job["等级"]]
                        txt += "\n✨【{}】分解等级提升！✨".format(play_name)
                    await player_write(number, "副职业", None, jobs)

        await send_message(message, 0, 1, txt)
        return
    else:
        txt = "\n【[{}]无法分解！】".format(resolve_name)
        await send_message(message, 0, 1, txt)
        return
            
async def help_resolve_thing(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    play_name = await player_name(uid)
    help_player = (message.content.split("分解")[0]).split("委托")[1]
    try:
        help_player_uid = int(help_player)
        help_player_number = await player_number(help_player_uid)
    except ValueError:
        txt = "\n【委托uid错误！】".format(resolve_name)
        await send_message(message, 0, 1, txt)
        return

    resolve0 = message.content.split("分解")[1]
    resolve1 = resolve0.split("*")
    if len(resolve1) == 1:
        resolve_name = resolve1[0]
        resolve_number = 1
    elif len(resolve1) == 2:
        resolve_name = resolve0.split("*")[0]
        resolve_number = int(resolve0.split("*")[1])
    enough_return = await bag_enough(uid, resolve_name, resolve_number)
    if "不够" in enough_return:
        txt = "\n【你没有足够的[{}]！】".format(resolve_name)
        await send_message(message, 0, 1, txt)
        return
    
    try:
        jobs = await player_read(help_player_number, "副职业", None)
        if not any(job["副职业"] == "分解师" for job in jobs):
            if_job = False
            txt = "\n【委托者非分解师！】".format(resolve_name)
            await send_message(message, 0, 1, txt)
            return
        else:
            if_job = True
            job_level = int([job["等级"] for job in jobs if job["副职业"] == "分解师"][0])
    except TypeError:
        txt = "\n【委托uid错误！】".format(resolve_name)
        await send_message(message, 0, 1, txt)
        return
    need_money = int(10 + (5 + job_level * 0.5) * resolve_number)
    need_txt = await bag_enough(uid, "铜币", need_money)
    if "不够" in need_txt:
        txt = "\n【缺少委托费用[铜币]×{}】".format(need_txt.split("缺")[1])
        await send_message(message, 0, 1, txt)
        return
    found = False
    with open(f"data/必备_resolve.txt", 'r') as f:
        resolve_data = json.load(f)
    if resolve_name in resolve_data:
        resolve_thing = {}
        for i in range(resolve_number):
            for resolve_item in resolve_data[resolve_name]["普通"]:
                resolve_result = resolve_item.split("*")
                resolve_result_name = resolve_result[0]
                resolve_result_number = resolve_result[1]
                resolve_result_percent = float(resolve_result[2])
                random_float = random.uniform(0, 100)
                if if_job:
                    resolve_result_percent = resolve_result_percent * (1 + job_level * 0.02)
                if random_float > resolve_result_percent:
                    continue
                if "-" in resolve_result_number:
                    resolve_result_number_min = int(resolve_result_number.split("-")[0])
                    resolve_result_number_max = int(resolve_result_number.split("-")[1])
                    resolve_result_number = random.randint(resolve_result_number_min, resolve_result_number_max)
                    if if_job:
                        resolve_result_number = int(resolve_result_number * (1 + job_level * 0.02))
                else:
                    resolve_result_number = int(resolve_result_number)
                if resolve_result_name in resolve_thing:
                    resolve_thing[resolve_result_name] += resolve_result_number
                else:
                    resolve_thing[resolve_result_name] = resolve_result_number
            if if_job:
                for resolve_item in resolve_data[resolve_name]["特殊"]:
                    resolve_result = resolve_item.split("*")
                    resolve_result_name = resolve_result[0]
                    resolve_result_number = resolve_result[1]
                    resolve_result_percent = float(resolve_result[2])
                    random_float = random.uniform(0, 100)
                    if if_job:
                        resolve_result_percent = resolve_result_percent * (1 + job_level * 0.02)
                    if random_float > resolve_result_percent:
                        continue
                    if "-" in resolve_result_number:
                        resolve_result_number_min = int(resolve_result_number.split("-")[0])
                        resolve_result_number_max = int(resolve_result_number.split("-")[1])
                        resolve_result_number = random.randint(resolve_result_number_min, resolve_result_number_max)
                        if if_job:
                            resolve_result_number = int(resolve_result_number * (1 + job_level * 0.02))
                    else:
                        resolve_result_number = int(resolve_result_number)
                    if resolve_result_name in resolve_thing:
                        resolve_thing[resolve_result_name] += resolve_result_number
                    else:
                        resolve_thing[resolve_result_name] = resolve_result_number

        await bag_reduce(uid, resolve_name, resolve_number)
        await bag_reduce(uid, "铜币", need_money)
        await bag_add(help_player_uid, "铜币", need_money)
        txt = "\n【委托花费[{}]铜币】\n【分解了[{}] × {}】\n得到：".format(need_money, resolve_name, resolve_number)
        for result_name, result_number in resolve_thing.items():
            if result_number == 0:
                continue
            txt += "\n[{}] × {}".format(result_name, result_number)
            await bag_add(uid, result_name, result_number)
        if if_job:
            for job in jobs:
                if job["副职业"] == "分解师":
                    get_exp = int(resolve_number)
                    if get_exp > job["精力"]:
                        get_exp = job["精力"]
                    job["熟练度"] = int(job["熟练度"] + get_exp)
                    job["精力"] = int(job["精力"] - get_exp)
                    exp_list = [100, 400, 1500, 2500, 4500, 8000, 15000, 40000, 100000, 600000, 9999999999]
                    job["熟练度上限"] = exp_list[job["等级"]]
                    if job["熟练度"] >= job["熟练度上限"]:
                        job["等级"] += 1
                        job["熟练度"] -= job["熟练度上限"]
                        job["熟练度上限"] = exp_list[job["等级"]]
                        energy_max = [200, 400, 600, 800, 1000, 1500, 2000, 3000, 4000, 5000, 0]
                        job["精力上限"] = energy_max[job["等级"]]
                    await player_write(help_player_number, "副职业", None, jobs)

        await send_message(message, 0, 1, txt)
        return
    else:
        txt = "\n【[{}]无法分解！】".format(resolve_name)
        await send_message(message, 0, 1, txt)
        return
    
async def action_use(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    use_word = message.content.split("使用")[1]
    if use_word == "":
        txt = "\n【未输入使用的物品！】"
        await send_message(message, 0, 1, txt)
        return
    use_split = use_word.split("*")
    if len(use_split) == 1:
        use_thing = use_split[0]
        use_number = 1
    elif len(use_split) == 2:
        use_thing = use_split[0]
        use_number = int(use_split[1])
    else:
        txt = "\n【消息格式错误！】"
        await send_message(message, 0, 1, txt)
        return
    
    use_thing0 = use_thing
    use_thing = use_thing.split("+")[0]


    if not isinstance(use_number, (int, float)) or use_number <= 0:
        txt = "\n【使用数量错误！】"
        await send_message(message, 0, 1, txt)
        return
    
    if ("不够" in await bag_enough(uid, use_thing, use_number)):
        txt = "\n【你没有足够的[{}]！】".format(use_thing)
        await send_message(message, 0, 1, txt)
        return
    

    if "·技能书" in use_thing:
        skill_name = use_thing.split("·技能书")[0]
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        found = False
        for skill in data["学会技能"]:
            if skill["名称"] == skill_name:
                found = True
                break

        if found:
            if "熟练度" in skill:
                skill["熟练度"] += use_number
            else:
                skill["熟练度"] = use_number
            need_exp = (skill["等级"] + 1) * (skill["等级"] + 2) / 2
            txt = "\n【你加深了对[{}]的感悟】\n◈[{}]熟练度增加{}({}/{})".format(skill_name, skill_name, use_number, skill["熟练度"], need_exp)
            while int(skill["熟练度"]) >= need_exp:
                level_1 = skill["等级"]
                skill["等级"] += 1
                skill["熟练度"] = int(skill["熟练度"] - need_exp)
                level_2 = skill["等级"]
                txt += "\n◈[{}]等级提升[{}]➟[{}]".format(skill_name, level_1, level_2)
                need_exp = (skill["等级"] + 1)* (skill["等级"] + 2) / 2
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, allow_nan=False, indent=4)
            await bag_reduce(uid, use_thing, use_number)
            await send_message(message, 0, 1, txt)
            return
        if not found:
            txt = "\n【你学习了技能[{}]】".format(skill_name)
            data["学会技能"].append({"名称": skill_name, "等级": 0, "熟练度": 0})
            if use_number > 1:
                for skill in data["学会技能"]:
                    if skill["名称"] == skill_name:
                        skill["熟练度"] = int(skill["熟练度"] + use_number - 1)
                        break
                txt += "\n【你加深了对[{}]的感悟】\n◈[{}]熟练度增加{}".format(skill_name, skill_name, use_number - 1)
                need_exp = (skill["等级"] + 1) * (skill["等级"] + 2) / 2
                while int(skill["熟练度"]) >= need_exp:
                    level_1 = skill["等级"]
                    skill["等级"] += 1
                    skill["熟练度"] = int(skill["熟练度"] - need_exp)
                    level_2 = skill["等级"]
                    txt += "\n◈[{}]等级提升[{}]➟[{}]".format(skill_name, level_1, level_2)
                    need_exp = (skill["等级"] + 1)* (skill["等级"] + 2) // 2
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, allow_nan=False, indent=4)
            await bag_reduce(uid, use_thing, use_number)
            await send_message(message, 0, 1, txt)
            return
    
    if use_thing == "小血瓶" or use_thing == "小魔瓶" or use_thing == "中血瓶" or use_thing == "中魔瓶" or use_thing == "大血瓶" or use_thing == "大魔瓶" or use_thing == "草莓" or use_thing == "蓝莓" or use_thing == "闪亮的祝福":
        txt = "\n【你服用了[{}] × {}】".format(use_thing, use_number)
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        max_hp = data["生命"]["当前最大"]
        now_hp = data["生命"]["当前"]
        max_mp = data["魔力"]["当前最大"]
        now_mp = data["魔力"]["当前"]
        if_hp = False
        if_mp = False
        if use_thing == "草莓":
            if_hp = True
            up_hp = 888
        if use_thing == "小血瓶":
            if_hp = True
            up_hp = max_hp * 0.01 + 100
        if use_thing == "中血瓶":
            if_hp = True
            up_hp = max_hp * 0.02 + 300
        if use_thing == "大血瓶":
            if_hp = True
            up_hp = max_hp * 0.03 + 1000
        if use_thing == "蓝莓":
            if_mp = True
            up_mp = 888
        if use_thing == "小魔瓶":
            if_mp = True
            up_mp = max_mp * 0.01 + 100
        if use_thing == "中魔瓶":
            if_mp = True
            up_mp = max_mp * 0.02 + 300
        if use_thing == "大魔瓶":
            if_mp = True
            up_mp = max_mp * 0.03 + 1000
        if use_thing == "闪亮的祝福":
            if_mp = True
            up_mp = max_mp * 0.5
            if_hp = True
            up_hp = max_hp * 0.5
        if if_hp == True:
            up_hp *= use_number
            up_hp = int(up_hp)
            hp_now = now_hp + up_hp
            if hp_now > max_hp:
                hp_now = max_hp
            data["生命"]["当前"] = hp_now
            txt += "\n◈生命回复了{}({}→{})".format(up_hp, now_hp, hp_now)
        if if_mp == True:
            up_mp *= use_number
            up_mp = int(up_mp)
            mp_now = now_mp + up_mp
            if mp_now > max_mp:
                mp_now = max_mp
            data["魔力"]["当前"] = mp_now
            txt += "\n◈魔力回复了{}({}→{})".format(up_mp, now_mp, mp_now)
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, use_number)
        await send_message(message, 0, 1, txt)
        return
    
    blood_name1 = ["未知的精血", "闪亮的精血", "淡红色精血", "淡蓝色精血", "淡绿色精血", "淡黄色精血", "红色精血", "蓝色精血", "绿色精血", "黄色精血", "精灵之血"]
    if "精血" in use_thing and use_thing not in blood_name1:
        
        monster_name = use_thing.split("精血")[0]
        if not os.path.exists(f"data/monster/{monster_name}.txt"):
            txt = "\n【[{}]数据错误！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/monster/{monster_name}.txt", 'r') as f:
            data = json.load(f)
        txt = "\n【你炼化了[{}] × {}】".format(use_thing, use_number)
        attribute = ["体质", "敏捷", "力量", "智力"]
        result = {}
        x = 1
        while x <= use_number:
            for att in attribute:
                success_percent = data[att]["基础"] / 20 * 100
                fail_percent = (18 - data[att]["基础"]) / 60 * 100 + 100
                value_max = data[att]["成长"] * 10
                value_number = 1
                value_number_percent = 50
                success = False
                while value_number <= value_max:
                    ran_num = random.randint(1, 100)
                    if ran_num <= value_number_percent:
                        success = True
                        break
                    value_number += 1
                    value_number_percent = math.ceil(value_number_percent / 2)
                if not success:
                    value_number = 0
                else:
                    value_number /= 10
                success_random = random.randint(1, 100)
                fail_random = random.randint(101, 200)
                if att not in result:
                    result[att] = 0.0
                if success_random <= success_percent:
                    result[att] += value_number
                if fail_random <= fail_percent:
                    result[att] -= value_number
                result[att] = round(result[att], 1)
            x += 1

        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        change = False
        for key, value in result.items():
            if float(value) > 0:
                change = True
                txt += "\n◈{}增加了{}".format(key, value)
                player_data[key]["躯体"] += float(value)
                if player_data[key]["躯体"] > player_data["等级"]:
                    player_data[key]["躯体"] = player_data["等级"]
                player_data[key]["躯体"] = round(player_data[key]["躯体"], 1)
                txt += "({})⇑⇑⇑".format(player_data[key]["躯体"])
            if float(value) < 0:
                change = True
                txt += "\n◈{}降低了{}".format(key, -value)
                player_data[key]["躯体"] += float(value)
                if player_data[key]["躯体"] < 0:
                    player_data[key]["躯体"] = 0
                if player_data[key]["躯体"] > player_data["等级"]:
                    player_data[key]["躯体"] = player_data["等级"]
                player_data[key]["躯体"] = round(player_data[key]["躯体"], 1)
                txt += "({})⇓⇓⇓".format(player_data[key]["躯体"])
        if not change:
            txt += "\n◈什么都没有变化"
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, use_number)
        await send_message(message, 0, 1, txt)
        return


    if use_thing in blood_name1:
        txt = "\n【你炼化了[{}] × {}】".format(use_thing, use_number)
        if use_thing == "未知的精血":
            attribute = ["体质", "敏捷", "力量", "智力"]
            value = [0.1, 0.2, 0.3]
        elif use_thing == "闪亮的精血":
            attribute = ["体质", "敏捷", "力量", "智力"]
            value = [0.1, 0.2, 0.3, 0.4, 0.5]
        elif use_thing == "精灵之血":
            attribute = ["体质", "敏捷", "力量", "智力"]
            value = [1]
        elif use_thing == "淡红色精血":
            attribute = ["力量"]
            value = [0.1, 0.1, 0.1, 0.2, 0.2, 0.3]
        elif use_thing == "淡蓝色精血":
            attribute = ["智力"]
            value = [0.1, 0.1, 0.1, 0.2, 0.2, 0.3]
        elif use_thing == "淡绿色精血":
            attribute = ["体质"]
            value = [0.1, 0.1, 0.1, 0.2, 0.2, 0.3]
        elif use_thing == "淡黄色精血":
            attribute = ["敏捷"]
            value = [0.1, 0.1, 0.1, 0.2, 0.2, 0.3]
        elif use_thing == "红色精血":
            attribute = ["力量"]
            value = [0.1, 0.1, 0.2, 0.2, 0.2, 0.3, 0.3, 0.4, 0.5]
        elif use_thing == "蓝色精血":
            attribute = ["智力"]
            value = [0.1, 0.1, 0.2, 0.2, 0.2, 0.3, 0.3, 0.4, 0.5]
        elif use_thing == "绿色精血":
            attribute = ["体质"]
            value = [0.1, 0.1, 0.2, 0.2, 0.2, 0.3, 0.3, 0.4, 0.5]
        elif use_thing == "黄色精血":
            attribute = ["敏捷"]
            value = [0.1, 0.1, 0.2, 0.2, 0.2, 0.3, 0.3, 0.4, 0.5]
        result = {}
        x = 1
        while x <= use_number:
            att = random.choice(attribute)
            val = random.choice(value)
            if att not in result:
                result[att] = val
            else:
                result[att] += val
            result[att] = round(result[att], 1)
            x += 1
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        change = False
        for key, value in result.items():
            if float(value) > 0:
                change = True
                txt += "\n◈{}增加了{}".format(key, value)
                player_data[key]["躯体"] += float(value)
                if player_data[key]["躯体"] > player_data["等级"]:
                    player_data[key]["躯体"] = player_data["等级"]
                player_data[key]["躯体"] = round(player_data[key]["躯体"], 1)
                txt += "({})⇑⇑⇑".format(player_data[key]["躯体"])
            if float(value) < 0:
                change = True
                txt += "\n◈{}降低了{}".format(key, -value)
                player_data[key]["躯体"] += float(value)
                if player_data[key]["躯体"] < 0:
                    player_data[key]["躯体"] = 0
                if player_data[key]["躯体"] > player_data["等级"]:
                    player_data[key]["躯体"] = player_data["等级"]
                player_data[key]["躯体"] = round(player_data[key]["躯体"], 1)
                txt += "({})⇓⇓⇓".format(player_data[key]["躯体"])
        if not change:
            txt += "\n◈什么都没有变化"
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, use_number)
        await send_message(message, 0, 1, txt)
        return

    if use_thing == "银苹果" or use_thing == "新春祝福·银":
        if use_number > 1:
            txt = "\n【[{}]只能单个服用！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        disabilities = player_data["体魄"]
        disabilities_to_remove = [d for d in disabilities if "残疾" in d or "欠缺" in d]
        if disabilities_to_remove:
            random_disability = random.choice(disabilities_to_remove)
            disabilities.remove(random_disability)
            player_data["体魄"] = disabilities
        body1 = ["天生强壮", "天生大力", "天生灵活", "天生聪明"]
        body2 = ["天生强健", "天生神力", "天生灵巧", "天生聪慧"]
        body3 = ["轮回之体", "斗战之体", "神灵之体", "瞬之体"]
        body4 = ["轮回神体", "斗战神体", "仙灵之体", "影之体"]
        body5 = ["荒古圣体", "苍天霸体", "先天道体", "末影黑体"]
        random_number = random.randint(1, 100)
        if random_number <= 60:
            random_body = random.choice(body1)
        elif random_number > 60 and random_number <= 90:
            random_body = random.choice(body2)
        elif random_number > 90 and random_number <= 100:
            random_body = random.choice(body3)
        if random_body not in player_data["体魄"]:
            player_data["体魄"].append(random_body)
            txt = "\n【你服用了[{}]】\n你感觉到身体发生了翻天覆地的变化————".format(use_thing)
        else:
            txt = "\n【你服用了[{}]】\n你感觉到身体并没有变化。。。".format(use_thing)
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, 1)
        await send_message(message, 0, 1, txt)
        return


    if use_thing == "金苹果" or use_thing == "新春祝福·金":
        if use_number > 1:
            txt = "\n【[{}]只能单个服用！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        disabilities = player_data["体魄"]
        disabilities = [attr for attr in disabilities if "残疾" not in attr and "欠缺" not in attr]
        player_data["体魄"] = disabilities
        body1 = ["天生强壮", "天生大力", "天生灵活", "天生聪明"]
        body2 = ["天生强健", "天生神力", "天生灵巧", "天生聪慧"]
        body3 = ["轮回之体", "斗战之体", "神灵之体", "瞬之体"]
        body4 = ["轮回神体", "斗战神体", "仙灵之体", "影之体"]
        body5 = ["荒古圣体", "苍天霸体", "先天道体", "末影黑体"]
        random_number = random.randint(1, 100)
        if random_number <= 66:
            random_body = random.choice(body3)
        elif random_number > 66 and random_number <= 94:
            random_body = random.choice(body4)
        elif random_number > 94 and random_number <= 100:
            random_body = random.choice(body5)
        if random_body not in player_data["体魄"]:
            player_data["体魄"].append(random_body)
            txt = "\n【你服用了[{}]】\n你感觉到身体发生了翻天覆地的变化————".format(use_thing)
        else:
            txt = "\n【你服用了[{}]】\n你感觉到身体并没有变化。。。".format(use_thing)
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, 1)
        await send_message(message, 0, 1, txt)
        return

    if use_thing == "体魄觉醒针":
        if use_number > 1:
            txt = "\n【[{}]只能单个使用！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        disabilities = player_data["体魄"]
        disabilities = [attr for attr in disabilities if "残疾" not in attr and "欠缺" not in attr]
        player_data["体魄"] = disabilities
        body0 = player_data["体魄"]
        body1 = ["天生强壮", "天生大力", "天生灵活", "天生聪明"]
        body2 = ["天生强健", "天生神力", "天生灵巧", "天生聪慧"]
        body3 = ["轮回之体", "斗战之体", "神灵之体", "瞬之体"]
        body4 = ["轮回神体", "斗战神体", "仙灵之体", "影之体"]
        body5 = ["荒古圣体", "苍天霸体", "先天道体", "末影黑体"]
        body6 = ["梦幻之体", "无想之体", "乱次之体", "玄元之体"]
        body1 = [x for x in body1 if x not in body0]
        body2 = [x for x in body2 if x not in body0]
        body3 = [x for x in body3 if x not in body0]
        body4 = [x for x in body4 if x not in body0]
        body5 = [x for x in body5 if x not in body0]
        body6 = [x for x in body6 if x not in body0]
        body_list = [body1, body2, body3, body4, body5, body6]
        body_base = int(player_data["保底"].get("体魄觉醒针", 0)) + 1
        success = False
        for index, body in enumerate(body_list):
            if body:
                body_percent = [100, 50, 20, 10, 2.5, 0]
                body_number = [1, 2, 5, 10, 40, 100][index]
                if index < 5:
#                    success_percent = body_percent[index] * body_base * 0.25 * len(body)
                    success_percent = body_percent[index] * body_base
                else:
                    success_percent = body_percent[index] * (0.5 ** (4 - len(body)))
                body_random = random.random() * 100
                if body_random < success_percent:
                    success = True
                    selected_body = random.choice(body)
                    player_data["体魄"].append(selected_body)
                    body_base = 0
                    break
                elif body_base == body_number:
                    success = True
                    selected_body = random.choice(body)
                    player_data["体魄"].append(selected_body)
                    body_base = 0
                else:
                    break
        if success:
            player_data["保底"]["体魄觉醒针"] = 0
            txt = "\n【你使用了[{}]】\n你感觉到身体发生了翻天覆地的变化————".format(use_thing)
        else:
            player_data["保底"]["体魄觉醒针"] = body_base
            txt = "\n【你使用了[{}]】\n你感觉身体没有明显的变化。。。\n身体深处，一股暖流等待着厚积薄发({}/{})".format(use_thing, body_base, body_number)
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, 1)
        await send_message(message, 0, 1, txt)
        return

    if use_thing == "体魄觉醒针·极":
        if use_number > 1:
            txt = "\n【[{}]只能单个使用！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        disabilities = player_data["体魄"]
        disabilities = [attr for attr in disabilities if "残疾" not in attr and "欠缺" not in attr]
        player_data["体魄"] = disabilities
        body0 = player_data["体魄"]
        body1 = ["天生强壮", "天生大力", "天生灵活", "天生聪明"]
        body2 = ["天生强健", "天生神力", "天生灵巧", "天生聪慧"]
        body3 = ["轮回之体", "斗战之体", "神灵之体", "瞬之体"]
        body4 = ["轮回神体", "斗战神体", "仙灵之体", "影之体"]
        body5 = ["荒古圣体", "苍天霸体", "先天道体", "末影黑体"]
        body6 = ["梦幻之体", "无想之体", "乱次之体", "玄元之体"]
        body1 = [x for x in body1 if x not in body0]
        body2 = [x for x in body2 if x not in body0]
        body3 = [x for x in body3 if x not in body0]
        body4 = [x for x in body4 if x not in body0]
        body5 = [x for x in body5 if x not in body0]
        body6 = [x for x in body6 if x not in body0]
        body_list = [body1, body2, body3, body4, body5, body6]
        body_base = int(player_data["保底"].get("体魄觉醒针", 0)) + 1
        success = False
        for index, body in enumerate(body_list):
            if body:
                body_percent = [100, 50, 20, 10, 2.5, 0]
                body_number = [1, 2, 5, 10, 40, 100][index]
                if index < 5:
                    success_percent = 101
                else:
                    success_percent = body_percent[index] * (0.5 ** (4 - len(body)))
                body_random = random.random() * 100
                if body_random < success_percent:
                    success = True
                    selected_body = random.choice(body)
                    player_data["体魄"].append(selected_body)
                    body_base = 0
                    break
                elif body_base == body_number:
                    success = True
                    selected_body = random.choice(body)
                    player_data["体魄"].append(selected_body)
                    body_base = 0
                else:
                    break
        if success:
            player_data["保底"]["体魄觉醒针"] = 0
            txt = "\n【你使用了[{}]】\n你感觉到身体发生了翻天覆地的变化————".format(use_thing)
        else:
            player_data["保底"]["体魄觉醒针"] = body_base
            txt = "\n【你使用了[{}]】\n你感觉身体没有明显的变化。。。\n身体深处，一股暖流等待着厚积薄发({}/{})".format(use_thing, body_base, body_number)
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, 1)
        await send_message(message, 0, 1, txt)
        return

    if use_thing == "神性的血滴":
        if use_number > 1:
            txt = "\n【[{}]只能单个使用！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        blood0 = player_data["血脉"]
        blood1 = ["人王血脉", "青龙血脉", "朱雀血脉", "白虎血脉", "玄武血脉"]
        blood2 = ["人皇血脉", "青龙神血", "朱雀神血", "白虎神血", "玄武神血"]
        blood3 = ["霖水传承", "玄冰传承", "尧炎传承", "宙暗传承", "瑶光传承", "噬金传承", "风雷传承", "圣木传承"]
        blood0 = [blood for blood in blood0 if "血脉" not in blood and "神血" not in blood]
        random_number = random.randint(1, 100)
        if random_number <= 80:
            random_body = random.choice(blood1)
        elif random_number > 80 and random_number <= 100:
            random_body = random.choice(blood2)
        blood0.append(random_body)
        random_number = random.randint(1, 100)
        if random_number <= 1:
            random_body = random.choice(blood3)
            if random_body not in player_data["血脉"]:
                blood0.append(random_body)
        player_data["血脉"] = blood0
        txt = "\n【你感悟了[{}]】\n你感觉身体焕然一新。。。\n仿佛整个灵魂都发生了蜕变。。。".format(use_thing)
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, 1)
        await send_message(message, 0, 1, txt)
        return


    if use_thing == "天空粉尘":
        if use_number > 1:
            use_number = 1
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        if player_data["等级"] == 10 and int(player_data["灵阶"]) == 1:
            txt = "\n◈传闻道，这种尘埃源自大陆的创始，蕴含着天地的大道。\n◈你仔细窥察着它的纹络，心醉神迷，恍惚间被眼前之景所吞噬。\n◈周围的混沌片刻融化，你仿若魂游身外，此刻正翱翔于天际，妄图挣脱大陆的束缚。\n◈飘飘乎如遗世独立，羽化而登仙，不外如是。\n◈天空影映着你的身影，你向上却触手难及。\n◈无边无际的天空尽处，你察觉到一丝隐晦的目光，正在向你窥探。。。\n◈你心神一动，一种奇妙的感悟油然而生。。。\n————————————————\n◈回过神时，你又回到了刚刚的地方。\n◈源源不断的精纯能量正汇入你的四肢百骸，你感到体内有什么正在被打破。\n【[{}]突破灵阶枷锁】\n————————————\n【等级上限提升！】\n【初心➡窥尘】".format(player_data["nickname"])
            player_data["灵阶"] = 2
            player_data["装备技能"]["数量"] = 2
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
            await bag_reduce(uid, "天空粉尘", 1)
        else:
            txt = "\n◈你窥探了许久，什么都没有发生。。。"
        await send_message(message, 0, 1, txt)
        return

    if use_thing == "进化之种":
        if use_number > 1:
            use_number = 1
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        if player_data["等级"] == 20 and int(player_data["灵阶"]) == 2:
            txt = "\n◈你打开木盒，象征着进化的种子正散发诱人的光泽。\n◈你将脸凑近，感受着从中发散出来自灵魂的诱惑。\n◈你的呼吸加快，一缕淡金色的气息自种子中渗透而出，顺着你的鼻息向上。\n◈你的识海瞬间被一股舒爽的感觉侵占。\n◈此刻，你能听闻风的呢喃，能倾听花的倾诉，能辨识元素的踪迹，能感知大地的脉络。\n◈逐渐的，你的感受越叠越多，心绪愈加沉重。\n◈万千信息如同古神的低语，眼前的世界成为了意识的漩涡。\n◈你这才明白，何为学者所说的，来自于进化的诅咒。\n◈你尝试将心神剥离开来，费了九牛二虎之力终于回到了最真实的世界。\n◈然而此时，那颗种子已然消失不见。\n◈你感受到身体深处有一抹生机在蓬勃的跃动。\n这是源自进化的诅咒与祝福。\n————————————\n【[{}]突破灵阶枷锁】\n————————————\n【等级上限提升！】\n【窥尘➡开化】\n————————————\n【发送[进化面板]查看进化信息】".format(player_data["nickname"])
            player_data["灵阶"] = 3
            player_data["装备技能"]["数量"] += 1
            
            
            """进化机制"""
            player_data["进化"] = []
            player_data["进化诅咒"] = []
            with open(f"data/进化词条.txt", 'r') as f:
                evolute = json.load(f)
            random_evolute = random.choice(evolute)
            num_range = random_evolute["数值"].split("-")
            num_min = float(num_range[0])
            num_max = float(num_range[1])
            random_num = round(random.uniform(num_min, num_max), 2)
            random_evolute["数值"] = random_num
            player_data["进化"].append(random_evolute)


            if random.random() < 0.5:
                with open(f"data/进化诅咒.txt", 'r') as f:
                    unevolute = json.load(f)
                unevolute = [d for d in unevolute if d['部位'] == random_evolute["部位"]]
                random_unevolute = random.choice(unevolute)
                num_range = random_unevolute["数值"].split("-")
                num_min = float(num_range[0])
                num_max = float(num_range[1])
                random_num = round(random.uniform(num_min, num_max), 2)
                random_unevolute["数值"] = random_num
                player_data["进化诅咒"].append(random_unevolute)

            """进化机制"""


            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
            await bag_reduce(uid, "进化之种", 1)
        else:
            txt = "\n◈种子无比的沉寂。。。"
        await send_message(message, 0, 1, txt)
        return

    if "进化灵药" in use_thing:
        if use_number > 1:
            use_number = 1
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if int(data["灵阶"]) < 3:
            txt = "\n【你无法承受进化的洗礼！】"
            await send_message(message, 0, 1, txt)
            return
        use_name = use_thing0.split("+")[0]
        use_body = use_thing0.split("+")[1]
        can_use_body = ["头", "手", "身", "脚"]
        can_use_name = ["进化灵药α", "进化灵药β", "进化灵药γ"]
        if use_body not in can_use_body:
            txt = "\n【请选择正确的部位！】\n示例：[使用进化灵药α+头]"
            await send_message(message, 0, 1, txt)
            return
        if use_name not in can_use_name:
            txt = "\n【请选择正确的药剂类型！】\n示例：[使用进化灵药α+头]"
            await send_message(message, 0, 1, txt)
            return

        txt0 = "\n【你注射了[{}]——】\n◈药剂生效中。。。".format(use_name)
        
        """进化机制"""

        body_add = {"头": "智力", "身": "体质", "手": "力量", "脚": "敏捷", }
        evolute_attribute = body_add[use_body]
        if use_name == "进化灵药α":
            
            if random.random() < 0.8:
                evolute_attribute = body_add[use_body]
            else:
                evolute_attribute = random.choice(["智力", "力量", "体质", "敏捷"])
            
            evolute_attribute_number = random.choice([0.1, 0.2, 0.2, 0.3, 0.3, 0.3, 0.4, 0.4, 0.4, 0.4, 0.5, 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.7, 0.7, 0.8, 0.9, 1])
        
        elif use_name == "进化灵药β":

            if random.random() < 0.4:
                evolute_attribute = body_add[use_body]
            else:
                evolute_attribute = random.choice(["智力", "力量", "体质", "敏捷"])

            evolute_attribute_number = random.choice([0.5, 0.6, 0.6, 0.7, 0.7, 0.7, 0.8, 0.8, 0.8, 0.8, 0.9, 0.9, 0.9, 1, 1])

        elif use_name == "进化灵药γ":

            if random.random() <= 1:
                evolute_attribute = body_add[use_body]
            else:
                evolute_attribute = random.choice(["智力", "力量", "体质", "敏捷"])

            evolute_attribute_number = random.choice([-0.1, -0.2, -0.3])
        attribute1 = data[evolute_attribute]["进化"]
        data[evolute_attribute]["进化"] += evolute_attribute_number
        data[evolute_attribute]["进化"] = round(data[evolute_attribute]["进化"], 1)
        if data[evolute_attribute]["进化"] > 20:
            data[evolute_attribute]["进化"] = 20
        attribute2 = data[evolute_attribute]["进化"]
        if evolute_attribute_number > 0:
            if evolute_attribute == "力量":
                txt1 = "\n【你感觉肌肉更加茁壮——】"
            elif evolute_attribute == "智力":
                txt1 = "\n【你感觉头脑更加清醒——】"
            elif evolute_attribute == "体质":
                txt1 = "\n【你感觉身体更加结实——】"
            elif evolute_attribute == "敏捷":
                txt1 = "\n【你感觉行动更加灵活——】"
            txt1 += "\n◈[{}]提升{}({}→{})".format(evolute_attribute, evolute_attribute_number, attribute1, attribute2)
        else:
            if evolute_attribute == "力量":
                txt1 = "\n【你感觉肌肉略微松弛——】"
            elif evolute_attribute == "智力":
                txt1 = "\n【你感觉精神略微分散——】"
            elif evolute_attribute == "体质":
                txt1 = "\n【你感觉身体略微空虚——】"
            elif evolute_attribute == "敏捷":
                txt1 = "\n【你感觉行动略微迟缓——】"
            txt1 += "\n◈[{}]降低{}({}→{})".format(evolute_attribute, -evolute_attribute_number, attribute1, attribute2)
        
        if evolute_attribute == "力量":
            evolute_body = "手"
        elif evolute_attribute == "智力":
            evolute_body = "头"
        elif evolute_attribute == "体质":
            evolute_body = "身"
        elif evolute_attribute == "敏捷":
            evolute_body = "脚"

        if use_name == "进化灵药α":
            if_evolute = True
        elif use_name == "进化灵药β":
            if_evolute = True
        elif use_name == "进化灵药γ":
            if_evolute = False

        if use_name == "进化灵药α":
            evolute_percent = 0.4
            unevolute_percent = 0.25
        elif use_name == "进化灵药β":
            evolute_percent = 0.9
            unevolute_percent = 0.9

        if if_evolute:
            txt2 = ""
            if random.random() <= evolute_percent:
                with open(f"data/进化词条.txt", 'r') as f:
                    evolute0 = json.load(f)
                evolute = [i for i in evolute0 if i['部位'] == evolute_body]
                random_evolute = random.choice(evolute)
                player_evolute = data["进化"]
                while True:
                    count = 0
                    for every_evolute in player_evolute:
                        if every_evolute["部位"] == random_evolute["部位"]:
                            if random_evolute["词条"] == every_evolute["词条"]:
                                random_evolute = random.choice(evolute)
                                break
                            else:
                                count += 1
                    else:
                        break
                
                if count >= 5:
                    evolute_percent0 = 0
                else:
                    evolute_percent0 = 0.5 ** (count - 1)
                
                if random.random() < evolute_percent0:
                    num_range = random_evolute["数值"].split("-")
                    num_min = float(num_range[0])
                    num_max = float(num_range[1])
                    random_num = round(random.uniform(num_min, num_max), 2)
                    random_evolute["数值"] = random_num
                    player_evolute.append(random_evolute)
                    if evolute_body == "手":
                        txt2 = "\n【你感觉双手有什么禁锢被突破——】"
                    elif evolute_body == "脚":
                        txt2 = "\n【你感觉双腿有什么禁锢被突破——】"
                    elif evolute_body == "身":
                        txt2 = "\n【你感觉躯体内有什么禁锢被突破——】"
                    elif evolute_body == "头":
                        txt2 = "\n【你感觉脑海内有什么禁锢被突破——】"
                    txt2 += "\n◈发生了进化[{}]".format(random_evolute["词条"])
            
                    data["进化"] = player_evolute

            txt3 = ""
            if random.random() <= unevolute_percent:
                player_unevolute = data["进化诅咒"]
                with open(f"data/进化诅咒.txt", 'r') as f:
                    unevolute0 = json.load(f)
                unevolute = [i for i in unevolute0 if i['部位'] == evolute_body]
                random_unevolute = random.choice(unevolute)
                if player_unevolute:
                    count = 0
                    while True:
                        for every_unevolute in player_unevolute:
                            if random_unevolute["部位"] == every_unevolute["部位"]:
                                if random_unevolute["词条"] == every_unevolute["词条"]:
                                    random_unevolute = random.choice(unevolute)
                                    break
                                else:
                                    count += 1
                        else:
                            break
                if count < 4:
                    num_range = random_unevolute["数值"].split("-")
                    num_min = float(num_range[0])
                    num_max = float(num_range[1])
                    random_num = round(random.uniform(num_min, num_max), 2)
                    random_unevolute["数值"] = random_num
                    player_unevolute.append(random_unevolute)
                    if evolute_body == "手":
                        txt3 = "\n【你感觉双手部分噩化——】"
                    elif evolute_body == "脚":
                        txt3 = "\n【你感觉双腿部分噩化——】"
                    elif evolute_body == "身":
                        txt3 = "\n【你感觉身体部分噩化——】"
                    elif evolute_body == "头":
                        txt3 = "\n【你感觉头颅部分噩化——】"
                    txt3 += "\n◈发生了畸变[{}]".format(random_unevolute["词条"])

                    data["进化诅咒"] = player_unevolute

            await send_message(message, 0, 1, txt0)
            await send_message(message, 2, 2, txt1)
            if txt2 != "":
                await send_message(message, 3, 3, txt2)
            if txt3 != "":
                await send_message(message, 3, 4, txt3)
        else:
            unevolute0 = data["进化诅咒"]
            unevolute = [i for i in unevolute0 if i['部位'] == evolute_body]
            if not unevolute:
                txt = "\n【该部位无进化诅咒！】"
                await send_message(message, 0, 1, txt)
                return
            remove_unevolute = random.choice(unevolute)
            unevolute0.remove(remove_unevolute)
            data["进化诅咒"] = unevolute0
            txt1 += "\n◈清除了畸变[{}]".format(remove_unevolute["词条"])
            await send_message(message, 0, 1, txt0)
            await send_message(message, 3, 2, txt1)

        """进化机制"""
        if "够了" in await bag_enough(uid, use_name, 1):
            await bag_reduce(uid, use_name, 1)
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, allow_nan=False, indent=4)
            return
        else:
            txt = "\n【道具不足，进程终止！】"
            await send_message(message, 0, 1, txt)
            return

    if use_thing == "便携式传送门":
        txt = "\n◈发送[传送 坐标x*坐标y]进行传送\n◈示例：[传送100*100]"
        await send_message(message, 0, 1, txt)
        return

    if use_thing == "世界树信标":
        await bag_reduce(uid, "世界树信标", 1)
        await txt_write("player", "number", number, "x", 0)
        await txt_write("player", "number", number, "y", 0)
        await txt_write("player", "number", number, "地名", "世界树")
        txt = "\n【你传送至(0,0)世界树}】"
        await send_message(message, 0, 1, txt)
        return

    if use_thing == "狂暴之血":
        if use_number > 1:
            txt = "\n【[{}]只能挨个服用！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        for player_item in player_data["特殊效果"]:
            if "狂暴之血" in player_item:
                txt = "\n【你已经拥有此效果了哦！】"
                await send_message(message, 0, 1, txt)
                return
        player_data["特殊效果"].append("时限*狂暴之血*{}*60".format(str(int(float(time.time())))))
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, "狂暴之血", 1)
        txt = "\n【你服用了[{}]】\n◈短时间内输出大幅提升⇑⇑⇑".format(use_thing)
        await send_message(message, 0, 1, txt)
        return


    use_thing_1 = ["青铜宝箱", "白银宝箱", "黄金宝箱"]
    if use_thing in use_thing_1:
        if use_number > 1:
            txt = "\n【[{}]只能挨个开启！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/道具开箱.txt", 'r') as f:
            box_data = json.load(f)
        box_list = box_data[use_thing]
        probabilities = [int(box_item.split('*')[-1]) for box_item in box_list]
        box_result = random.choices(box_list, weights=probabilities, k=1)
        box_result_left = box_result[0].split("-")[0]
        box_result_right = box_result[0].split("-")[1]
        if box_result_left == "普通":
            txt = "\n【你使用了[{}]】\n一阵白光乍现————".format(use_thing)
        elif box_result_left == "稀有":
            txt = "\n【你使用了[{}]】\n一阵紫光乍现————".format(use_thing)
        elif box_result_left == "珍奇":
            txt = "\n【你使用了[{}]】\n一阵金光乍现————".format(use_thing)
        await send_message(message, 0, 1, txt)
        thing_name = box_result_right.split("*")[0]
        thing_number = box_result_right.split("*")[1]
        txt_result = "\n◈你获得[{}] × {}".format(thing_name, thing_number)
        await bag_reduce(uid, use_thing, 1)
        await bag_add(uid, thing_name, thing_number)
        await send_message(message, 6, 2, txt_result)
        return


    use_thing_2 = ["鲜能剂", "大份鲜能剂", "闪耀的鲜能剂"]
    if use_thing in use_thing_2:
        if use_number > 1:
            txt = "\n【[{}]只能挨个使用！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        if use_thing == "鲜能剂":
            strength_add = 10
            strength_txt = "你感觉身上又涌出了活力。"
        elif use_thing == "大份鲜能剂":
            strength_add = 25
            strength_txt = "你感觉到有源源不断的力气涌出。"
        elif use_thing == "闪耀的鲜能剂":
            strength_add = 60
            strength_txt = "你全身的每一处细胞都在跃动，仿佛焕然一新。"
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        strength_1 = player_data["体力"]
        strength_2 = strength_1 + strength_add
        player_data["体力"] = strength_2
        txt = "\n【你使用了[{}]】\n{}\n🍗{}→{}".format(use_thing, strength_txt, strength_1, strength_2)
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, allow_nan=False, indent=4)
        await bag_reduce(uid, use_thing, 1)
        await send_message(message, 0, 1, txt)
        return


    if use_thing == "小茗的赠礼":

        if use_number > 1:
            txt = "\n【[小茗的赠礼]只能挨个开启！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        txt = "\n【你使用了[小茗的赠礼]】"
        txt_result = "\n◈你获得[大兽肉] × 3\n◈你获得[大兽皮] × 3\n◈你获得[大兽骨] × 3\n◈你获得[大兽筋] × 3"
        await bag_reduce(uid, "小茗的赠礼", 1)
        await bag_add(uid, "大兽肉", 3)
        await bag_add(uid, "大兽皮", 3)
        await bag_add(uid, "大兽骨", 3)
        await bag_add(uid, "大兽筋", 3)
        await send_message(message, 0, 1, txt_result)
        return

    if use_thing == "晴儿的赠礼":
        
        if use_number > 1:
            txt = "\n【[晴儿的赠礼]只能挨个开启！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        txt = "\n【你使用了[晴儿的赠礼]】"
        txt_result = "\n◈你获得[血肉残骸] × 10\n◈你获得[能量余辉] × 3\n◈你获得[天空粉尘] × 1"
        await bag_reduce(uid, "晴儿的赠礼", 1)
        await bag_add(uid, "血肉残骸", 10)
        await bag_add(uid, "能量余辉", 3)
        await bag_add(uid, "天空粉尘", 1)
        await send_message(message, 0, 1, txt_result)
        return

    if use_thing == "漠北的赠礼":
        
        if use_number > 1:
            txt = "\n【[漠北的赠礼]只能挨个开启！】".format(use_thing)
            await send_message(message, 0, 1, txt)
            return
        txt = "\n【你使用了[漠北的赠礼]】"
        txt_result = "\n◈你获得[绿晶] × 3"
        await bag_reduce(uid, "漠北的赠礼", 1)
        await bag_add(uid, "绿晶", 3)
        await send_message(message, 0, 1, txt_result)
        return
        

    if use_thing == "魔引香":

        if use_number > 1:
            txt = "\n【[魔引香]只能单独使用！】"
            await send_message(message, 0, 1, txt)
            return

        txt = "\n【你使用了[魔引香]】\n伴随着幽香指引，你大致寻到了魔力的来源————"
        place = await txt_exist("player", "number", number, "地名")
        x = await txt_exist("player", "number", number, "x")
        y = await txt_exist("player", "number", number, "y")
        can_place = ["幽暗密林", "乱石滩地"]
        if place not in can_place:
            txt = "\n【请勿在此使用哦！】"
            await send_message(message, 0, 1, txt)
            return
        with open("data/boss_locate.txt", 'r') as f:
            boss_data = json.load(f)
        can_boss = {}
        for boss in boss_data:
            if boss["位置"] == place and boss["存活"] == "是":
                name = boss["名称"]
                length = abs(int(boss["当前"]["x"]) - int(x)) + abs(int(boss["当前"]["y"]) - int(y))
                can_boss[name] = length
        if not can_boss:
            txt = "\n【[{}]目前没有魔力的踪迹！】".format(place)
            await send_message(message, 0, 1, txt)
            return
        min_name = min(can_boss, key=can_boss.get)
        for boss in boss_data:
            if boss["名称"] == min_name:
                x = int(boss["当前"]["x"])
                y = int(boss["当前"]["y"])
                x += random.randint(-5, 5)
                y += random.randint(-5, 5)
                txt += "\n【({},{})】".format(x, y)
                await bag_reduce(uid, "魔引香", 1)
                await send_message(message, 0, 1, txt)
                return
        await send_message(message, 0, 1, "未知错误！")
        return
    
    if use_thing == "化龙涎":
        if use_number > 1:
            txt = "\n【[化龙涎]只能单独使用！】"
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        data["力量"]["加点"] = 0
        data["智力"]["加点"] = 0
        data["体质"]["加点"] = 0
        data["敏捷"]["加点"] = 0
        data["属性点"] = data["等级"] * 1
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        txt = "\n【你用心去体会泉水的秘密】\n【但流水匆匆，白驹过隙。。。】\n◈你感觉可以重新[分配属性]" 
        await bag_reduce(uid, "化龙涎", 1)
        await send_message(message, 0, 1, txt)
        return







    else:
        txt = "\n【不是可使用的物品！】"
        await send_message(message, 0, 1, txt)
        return




        
async def devide_attribute(message):
    if hasattr(message.author, 'member_openid'):
        player_number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        player_number = message.author.user_openid
    uid = await player_id(player_number)
    need = message.content.split("属性分配")[1]
    if "*" not in need:
        txt = "\n【分配格式错误！】\n示例：[属性分配体质*99]"
        await send_message(message, 0, 1, txt)
        return
    else:
        attribute = need.split("*")[0]
        number = int(need.split("*")[1])
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if (not number <= data["属性点"]) or not isinstance(number, (int, float)) or number <= 0:
            txt = "\n【分配数值错误！】\n◈你只有[{}]属性点\n◈示例：[属性分配体质*{}]".format(data["属性点"], data["属性点"])
            await send_message(message, 0, 1, txt)
            return
        elif attribute != "体质" and attribute != "敏捷" and attribute != "力量" and attribute != "智力":
            txt = "\n【分配属性错误！】\n◈属性只能是[体质][敏捷][力量][智力]其中一种\n◈示例：[属性分配体质*{}]".format(data["属性点"], data["属性点"])
            await send_message(message, 0, 1, txt)
            return
        elif (attribute == "体质" or attribute == "敏捷" or attribute == "力量" or attribute == "智力") and number <= data["属性点"]:
            data[attribute]["加点"] += number
            data["属性点"] -= number
            txt = "\n【分配成功！】\n◈你增加了{}[{}]点".format(attribute, number)
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return
        else:
            txt = "\n【未知错误！】\n◈请核对指令内容或联系管理员"
            await send_message(message, 0, 1, txt)
            return


async def worldtree_action(message):
    if hasattr(message.author, 'member_openid'):
        number = message.author.member_openid
    elif hasattr(message.author, 'user_openid'):
        number = message.author.user_openid
    uid = await player_id(number)
    player_place = await txt_exist("player", "number", number, "地名")
    heart = await player_read(number, "好感度")

    if "世界树" in player_place:
        if "铁匠" in str(message.content):
            await txt_write("player", "number", number, "地名", "世界树12")
            txt = "\n【漠北铁匠铺】\n清脆的打铁声不绝如缕。\n◈[1] 与[漠北]对话\n◈[2] 查看[清单]\n◈[3] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][2][3][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        if "糖水" in  str(message.content):
            await txt_write("player", "number", number, "地名", "世界树13")
            txt = "\n【晴空糖水屋】\n不大的店内，洋溢着令人愉悦的香气。\n◈[1] 与[晴儿]对话\n◈[2] 查看[清单]\n◈[3] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][2][3][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        if "道具" in str(message.content):
            await txt_write("player", "number", number, "地名", "世界树14")
            txt = "\n【小茗的道具店】\n墙上摆放着各类物品，让人眼花缭乱。\n◈[1] 与[小茗]对话\n◈[2] 查看[清单]\n◈[3] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][2][3][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        if "公会" in str(message.content):
            await txt_write("player", "number", number, "地名", "世界树21")
            txt = "\n【世界树•中层•冒险者公会】\n宽敞的大厅内，挤满了许多冒险者。\n◈[1] 走向 前台\n◈[2] 走向 委托板\n◈[3] 走向 悬赏板\n◈[4] 前往 兑换商店\n◈[0] 返回\n————————————\n发送[1][2][3][4][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        if  "传送门" in str(message.content):
            await txt_write("player", "number", number, "地名", "世界树24")
            txt = "\n【世界树•中层•世界传送门】\n一座巨大的传送法阵，有不少强者看守。\n◈发送[传送x*y]进行传送\n【需花费[200]铜币】\n◈[1] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return

    
    if player_place == "世界树":
        can_action = [1, 2, 3, 4, 5]
    elif player_place == "世界树1":
        can_action = [1, 2, 3, 4, 5, 0]
    elif player_place == "世界树12":
        can_action = [1, 2, 3, 0]
    elif player_place == "世界树121":
        can_action = [1, 2, 0]
    elif player_place == "世界树1212":
        can_action = [1, 0]
    elif player_place == "世界树122":
        can_action = [0]
    elif player_place == "世界树123":
        can_action = [0]
    elif player_place == "世界树13":
        can_action = [1, 2, 3, 0]
    elif player_place == "世界树131":
        can_action = [1, 2, 0]
    elif player_place == "世界树1312":
        can_action = [1, 0]
    elif player_place == "世界树132":
        can_action = [0]
    elif player_place == "世界树133":
        can_action = [0]
    elif player_place == "世界树14":
        can_action = [1, 2, 3, 0]
    elif player_place == "世界树141":
        can_action = [1, 2, 0]
    elif player_place == "世界树1412":
        can_action = [1, 0]
    elif player_place == "世界树142":
        can_action = [0]
    elif player_place == "世界树143":
        can_action = [0]
    elif player_place == "世界树2":
        can_action = [1, 2, 4, 0]
    elif player_place == "世界树21":
        can_action = [1, 2, 3, 0]
    elif player_place == "世界树211":
        can_action = [1, 2, 3, 4, 0]
    elif player_place == "世界树2113":
        can_action = [1, 0]
    elif player_place == "世界树2114":
        can_action = [0]
    elif player_place == "世界树212":
        can_action = [1, 2, 0]
    elif player_place == "世界树213":
        can_action = [1, 2, 0]
    elif player_place == "世界树22":
        can_action = [2, 0]
    elif player_place == "世界树222":
        can_action = [1, 0]
    elif player_place == "世界树2221":
        can_action = [1, 2, 0]
    elif player_place == "世界树24":
        can_action = [0, 1]
    elif player_place == "世界树241":
        can_action = [0]
    elif player_place == "世界树3":
        can_action = [1, 0]
    elif player_place == "世界树31":
        can_action = [1, 2, 3, 4, 0]
    elif player_place == "世界树311":
        can_action = [1, 2, 0]
    elif player_place == "世界树312":
        can_action = [1, 2, 0]
    elif player_place == "世界树313":
        can_action = [1, 2, 0]
    elif player_place == "世界树314":
        can_action = [1, 2, 0]
    elif player_place == "世界树3111":
        can_action = [1, 2, 0]
    elif player_place == "世界树3112":
        can_action = [1, 2, 0]
    elif player_place == "世界树31111":
        can_action = [1, 0]
    elif player_place == "世界树31112":
        can_action = [1, 2, 0]
    elif player_place == "世界树31121":
        can_action = [1, 0]
    elif player_place == "世界树31122":
        can_action = [1, 2, 0]
    elif player_place == "世界树3121":
        can_action = [1, 0]
    elif player_place == "世界树3122":
        can_action = [1, 2, 0]
    elif player_place == "世界树3131":
        can_action = [1, 0]
    elif player_place == "世界树3132":
        can_action = [1, 2, 0]
    elif player_place == "世界树3141":
        can_action = [1, 0]
    elif player_place == "世界树3142":
        can_action = [1, 2, 0]

    
    if str(message.content) == "结束打工":
        state = await txt_exist("player", "number", number, "状态")
        if state != "打工":
            txt = "\n【你不在打工哦！】"
            await send_message(message, 0, 1, txt)
            return
    
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        work = data["打工信息"]
        work_place = work["打工地点"]
        work_start_time = work["打工时间"]
        work_end_time = int(time.time())
        work_time = work_end_time - work_start_time
        work_level = work["打工等级"]
        if work_place == "晴空糖水屋":
            work_reward = {"副职业": "炼金师", "副经验": 2, "经验": 0.125, "铜币": 1, "铜币增长": 0.2}
        elif work_place == "小茗的道具店":
            work_reward = {"副职业": "分解师", "副经验": 2, "经验": 0.125, "铜币": 1, "铜币增长": 0.2}
        elif work_place == "漠北铁匠铺":
            work_reward = {"副职业": "锻造师", "副经验": 2, "经验": 0.125, "铜币": 1, "铜币增长": 0.2}
        elif work_place == "冒险者公会":
            work_reward = {"经验": 0.25, "代币": 0.05, "代币增长": 0.005}
        elif work_place == "世界传送门":
            work_reward = {"经验": 0.25, "铜币": 2, "铜币增长": 0.2}
        
        days = work_time // 86400  # 计算天数
        hours = (work_time % 86400) // 3600  # 计算小时数
        minutes = (work_time % 3600) // 60  # 计算分钟数

        txt = "\n【你工作了{}天{}时{}分】".format(days, hours, minutes)
        
        if days == 0 and hours == 0:
            txt = "\n【你没有完成工作指标，被扣除了所有奖励！】"
            if work_place == "晴空糖水屋":
                if "晴儿" not in data["好感度"]:
                    data["好感度"]["晴儿"] = -1
                else:
                    data["好感度"]["晴儿"] -= 1
            elif work_place == "小茗的道具店":
                if "小茗" not in data["好感度"]:
                    data["好感度"]["小茗"] = -1
                else:
                    data["好感度"]["小茗"] -= 1
            elif work_place == "漠北铁匠铺":
                if "漠北" not in data["好感度"]:
                    data["好感度"]["漠北"] = -1
                else:
                    data["好感度"]["漠北"] -= 1
            elif work_place == "冒险者公会":
                if "狐狐" not in data["好感度"]:
                    data["好感度"]["狐狐"] = -1
                else:
                    data["好感度"]["狐狐"] -= 1
            elif work_place == "世界传送门":
                if "传送门守卫" not in data["好感度"]:
                    data["好感度"]["传送门守卫"] = -1
                else:
                    data["好感度"]["传送门守卫"] -= 1
            data["打工信息"] = {}
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await txt_write("player", "number", number, "状态", "行动")
            await send_message(message, 0, 1, txt)
            return
        if days < 1:
            true_time = 60 * hours + minutes
        elif days >= 1 and days < 3:
            true_time = 60 * 24 + (((days - 1) * 24 + hours) * 60 + minutes) * 0.75
        elif days >= 3 and days < 7:
            true_time = 60 * 24 + 60 * 24 * 2 * 0.75 + (((days - 3) * 24 + hours) * 60 + minutes) * 0.6
        elif days >= 7 and days < 15:
            true_time = 60 * 24 + 60 * 24 * 2 * 0.75 + 60 * 24 * 4 * 0.6 + (((days - 7) * 24 + hours) * 60 + minutes) * 0.4
        elif days >= 15 and days < 30:
            true_time = 60 * 24 + 60 * 24 * 2 * 0.75 + 60 * 24 * 4 * 0.6 + 60 * 24 * 8 * 0.4 + (((days - 15) * 24 + hours) * 60 + minutes) * 0.2
        elif days >= 30:
            true_time = 60 * 24 + 60 * 24 * 2 * 0.75 + 60 * 24 * 4 * 0.6 + 60 * 24 * 8 * 0.4 + 60 * 24 * 15 * 0.2 + (((days - 30) * 24 + hours) * 60 + minutes) * 0.1

        if work_place == "晴空糖水屋":
            if "晴儿" not in data["好感度"]:
                data["好感度"]["晴儿"] = days
            else:
                data["好感度"]["晴儿"] += days
        elif work_place == "小茗的道具店":
            if "小茗" not in data["好感度"]:
                data["好感度"]["小茗"] = days
            else:
                data["好感度"]["小茗"] += days
        elif work_place == "漠北铁匠铺":
            if "漠北" not in data["好感度"]:
                data["好感度"]["漠北"] = days
            else:
                data["好感度"]["漠北"] += days
        elif work_place == "冒险者公会":
            if "狐狐" not in data["好感度"]:
                data["好感度"]["狐狐"] = days
            else:
                data["好感度"]["狐狐"] += days
        elif work_place == "世界传送门":
            if "传送门守卫" not in data["好感度"]:
                data["好感度"]["传送门守卫"] = days
            else:
                data["好感度"]["传送门守卫"] += days
        
        if work_reward.get("铜币", 0) > 0 or work_reward.get("铜币增长", 0) > 0:
            true_reward1 = int((work_reward["铜币增长"] * work_level + work_reward["铜币"]) * true_time)
        if work_reward.get("经验", 0) > 0:
            true_exp = int(work_reward["经验"] * true_time)
        if work_reward.get("副经验", 0) > 0:
            true_work_exp = int(work_reward["副经验"] * true_time)
        if work_reward.get("代币", 0) > 0 or work_reward.get("代币增长", 0) > 0:
            true_reward2 = int((work_reward["代币增长"] * work_level + work_reward["代币"]) * true_time)
        
        if work_reward.get("副经验", 0) > 0:
            for job in data["副职业"]:
                if job["副职业"] == work_reward["副职业"]:
                    get_exp = int(true_work_exp)
                    if get_exp > job["精力"]:
                        get_exp = job["精力"]
                        true_work_exp = job["精力"]
                    job["熟练度"] = int(job["熟练度"] + get_exp)
                    job["精力"] = int(job["精力"] - get_exp)
                    exp_list = [100, 400, 1500, 2500, 4500, 8000, 15000, 40000, 100000, 600000, 9999999999]
                    job["熟练度上限"] = exp_list[job["等级"]]
                    txt += "\n◈[{}]熟练度+{}".format(job["副职业"], get_exp)
                    if job["熟练度"] >= job["熟练度上限"]:
                        job["等级"] += 1
                        job["熟练度"] -= job["熟练度上限"]
                        job["熟练度上限"] = exp_list[job["等级"]]
                        energy_max = [200, 400, 600, 800, 1000, 1500, 2000, 3000, 4000, 5000, 0]
                        job["精力上限"] = energy_max[job["等级"]]
                        txt += "\n✨【{}】副职业等级提升！✨".format(data["nickname"])
        
        if work_reward.get("经验", 0) > 0:
            txt += "\n◈EXP+{}".format(true_exp)
            exp_now = data["经验"]["当前"]
            exp_now += true_exp
            level = data["等级"]
            exp_max = await exp_up(level)
            level_max = int(data["灵阶"]) * 10
            while exp_now >= exp_max:
                if int(level) >= level_max:
                    exp_now = exp_max
                    txt += "\n◈精纯的能量冲入你的体壳，然后向外四溢，消散在了空中。。。"
                    break
                data["属性点"] += 1
                exp_now -= exp_max
                level += 1
                exp_max = await exp_up(level)
                txt += "\n◈【{}】升到{}级\n可以[属性分配]".format(data["nickname"], level)
                """进化机制"""
                if int(data["灵阶"]) == 3:
                    with open(f"data/进化词条.txt", 'r') as f:
                        evolute = json.load(f)
                    random_evolute = random.choice(evolute)
                    player_evolute = data["进化"]
                    while True:
                        count = 0
                        for every_evolute in player_evolute:
                            if every_evolute["部位"] == random_evolute["部位"]:
                                if random_evolute["词条"] == every_evolute["词条"]:
                                    random_evolute = random.choice(evolute)
                                    break
                                else:
                                    count += 1
                        else:
                            break
                    if count >= 5:
                        evolute_percent = 0
                    else:
                        evolute_percent = 0.5 ** (count - 1)
                    if random.random() < evolute_percent:
                        num_range = random_evolute["数值"].split("-")
                        num_min = float(num_range[0])
                        num_max = float(num_range[1])
                        random_num = round(random.uniform(num_min, num_max), 2)
                        random_evolute["数值"] = random_num
                        player_evolute.append(random_evolute)
                        data["进化"] = player_evolute

                    if random.random() < 0.75:
                        player_unevolute = data["进化诅咒"]
                        with open(f"data/进化诅咒.txt", 'r') as f:
                            unevolute = json.load(f)
                        unevolute = [d for d in unevolute if d['部位'] == random_evolute["部位"]]
                        random_unevolute = random.choice(unevolute)
                        while True:
                            count = 0
                            for every_unevolute in player_unevolute:
                                if random_unevolute["部位"] == every_unevolute["部位"]:
                                    if random_unevolute["词条"] == every_unevolute["词条"]:
                                        random_unevolute = random.choice(unevolute)
                                        break
                                    else:
                                        count += 1
                            else:
                                break
                        if count < 4:
                            num_range = random_unevolute["数值"].split("-")
                            num_min = float(num_range[0])
                            num_max = float(num_range[1])
                            random_num = round(random.uniform(num_min, num_max), 2)
                            random_unevolute["数值"] = random_num
                            player_unevolute.append(random_unevolute)

                            await player_write(number, "进化诅咒", None, player_unevolute)
              
                """进化机制"""
            data["经验"]["当前"] = exp_now
            data["经验"]["最大"] = exp_max
            data["等级"] = level

        if work_reward.get("铜币", 0) > 0 or work_reward.get("铜币增长", 0) > 0:
            await bag_add(uid, "铜币", true_reward1)
            txt += "\n◈获得报酬[铜币]×{}".format(true_reward1)
        if work_reward.get("代币", 0) > 0 or work_reward.get("代币增长", 0) > 0:
            await bag_add(uid, "公会代币", true_reward2)
            txt += "\n◈获得报酬[公会代币]×{}".format(true_reward2)
        data["打工信息"] = {}
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        await txt_write("player", "number", number, "状态", "行动")
        await send_message(message, 0, 1, txt)
        return
        
    if player_place == "世界树123" and str(message.content) == "开始打工":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if not any(job["副职业"] == "锻造师" for job in data["副职业"]):
            txt = "\n【漠北铁匠铺】\n『漠北』\n“你对此一窍不通呢，还是别来捣乱了！”"
            await send_message(message, 0, 1, txt)
            return
        level = next((job['等级'] for job in data['副职业'] if job['副职业'] == '锻造师'), 0)
        timestamp = int(time.time())
        data["打工信息"] = {"打工地点": "漠北铁匠铺", "打工时间": timestamp, "打工等级": level}
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        await txt_write("player", "number", number, "状态", "打工")
        txt = "\n【漠北铁匠铺】\n『漠北』\n“麻烦把炉子再烧热一些！”\n“今天还有不少订单要忙呢！”\n————————————\n【发送[结束工作]结束】"
        await send_message(message, 0, 1, txt)
        return

    if player_place == "世界树133" and str(message.content) == "开始打工":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if not any(job["副职业"] == "炼金师" for job in data["副职业"]):
            txt = "\n【晴空糖水屋】\n『晴儿』\n“非炼金师不能应聘哦！”"
            await send_message(message, 0, 1, txt)
            return
        level = next((job['等级'] for job in data['副职业'] if job['副职业'] == '炼金师'), 0)
        timestamp = int(time.time())
        data["打工信息"] = {"打工地点": "晴空糖水屋", "打工时间": timestamp, "打工等级": level}
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        await txt_write("player", "number", number, "状态", "打工")
        txt = "\n【晴空糖水屋】\n『晴儿』\n“炼金台在这儿，请跟我来~”\n“累了的话记得休息哦！”\n————————————\n【发送[结束工作]结束】"
        await send_message(message, 0, 1, txt)
        return

    if player_place == "世界树143" and str(message.content) == "开始打工":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if not any(job["副职业"] == "分解师" for job in data["副职业"]):
            txt = "\n【小茗的道具店】\n『小茗』\n“你不是分解师，不能胜任此工作！”"
            await send_message(message, 0, 1, txt)
            return
        level = next((job['等级'] for job in data['副职业'] if job['副职业'] == '分解师'), 0)
        timestamp = int(time.time())
        data["打工信息"] = {"打工地点": "小茗的道具店", "打工时间": timestamp, "打工等级": level}
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        await txt_write("player", "number", number, "状态", "打工")
        txt = "\n【小茗的道具店】\n『小茗』\n“那么，这一堆材料交给你了~”\n“要细心的分解嗷！”\n————————————\n【发送[结束工作]结束】"
        await send_message(message, 0, 1, txt)
        return
    
    
    if player_place == "世界树21" and str(message.content) == "4":
        
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "冒险者公会" not in data:
            txt = "\n【冒险家公会•兑换商店】\n『吉祥物·猫猫』\n这位冒险者，你尚未加入公会哦！"
            await send_message(message, 0, 1, txt)
            return
        
        txt = "\n【冒险家公会•兑换商店】\n『吉祥物·猫猫』\n冒险家大人又凯旋归来了喵~\n有想念猫猫么喵~\n今天又要来换什么喵~\n【发送[公会商店]查看相关信息】"
        await txt_write("player", "number", number, "状态", "公会商店")
        await send_message(message, 0, 1, txt)
        return

    if player_place == "世界树211" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "冒险者公会" in data:
            txt = "\n『狐狐』\n这位冒险者，你已经注册在档案中了哦！"
        else:
            data["冒险者公会"] = {"等级": "F", "声望": 0, "冒险团": "", "功能": ""}
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            txt = "\n『狐狐』\n恭喜你，成为了我们的一员！\n请收下这张卡片，它将是你出入很多特殊场所的凭证。\n记得努力去提升自己的声望哦，你将会获得公会给予的各种便利特权。并记得按时来我这儿进行等级评定！\n完成公会的委托以和悬赏可以获得大量的声望，快快努力吧！\n【发送[冒险卡片]查看相关信息】"
        await send_message(message, 0, 1, txt)
        return

    if player_place == "世界树211" and str(message.content) == "2":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "冒险者公会" in data:
            rank = data["冒险者公会"]["等级"]
            level = data["等级"]
            fame = data["冒险者公会"]["声望"]
            if rank == "F":
                if level < 15 or fame < 100:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/15),声望({}/100)】".format(level, fame)
                    await send_message(message, 0, 1, txt)
                    return
                else:
                    if not any(item['名称'] == '等级评定 E' for item in data["任务"]):
                        txt = "\n『狐狐』\n在幽暗密林中，栖息着一种巨大的史莱姆，它们有着庞大的身躯以及不俗的力量。\n请前去击败它们证明自己吧！\n要记得保留新鲜的气息作为凭证哦！\n【任务目标】\n讨伐[森林史莱姆](0/1)\n讨伐[岩石史莱姆](0/1)"
                        data["任务"].append({"名称": "等级评定 E", "来源": "冒险者公会", "类型": "等级评定", "目标": [{"类型": "讨伐", "对象": "森林史莱姆", "数量": 1, "已讨伐": 0}, {"类型": "讨伐", "对象": "岩石史莱姆", "数量": 1, "已讨伐": 0}], "奖励": "事件*晋升[E级冒险家]", "剩余时间": "无期限", "编码": 0})
                        with open(f"data/player/{uid}.txt", 'w') as f:
                            json.dump(data, f, ensure_ascii=False, indent=4)
                        await send_message(message, 0, 1, txt)
                        return
                    else:
                        item = next(item for item in data["任务"] if item['名称'] == '等级评定 E')
                        success = True
                        aim_txt = ""
                        for item_aim in item['目标']:
                            if item_aim["类型"] == "讨伐":
                                if item_aim["已讨伐"] < item_aim["数量"]:
                                    success = False
                                    aim_txt += "\n[{}]{}({}/{})".format(item_aim["类型"], item_aim["对象"], item_aim["已讨伐"], item_aim["数量"])
                            elif item_aim["类型"] == "收集":
                                have_number = await bag_number(uid, item_aim["对象"])
                                if have_number < item_aim["数量"]:
                                    success = False
                                    aim_txt += "\n[{}]{}({}/{})".format(item_aim["类型"], item_aim["对象"], have_number, item_aim["数量"])
                        if not success:
                            txt = "\n『狐狐』\n你还未完成相应要求哦~\n请先去完成再来吧！" + aim_txt
                            await send_message(message, 0, 1, txt)
                            return
                        else:
                            data["冒险者公会"]["等级"] = "E"
                            data["任务"] = [task for task in data["任务"] if task['名称'] != '等级评定 E']
                            txt = "\n『狐狐』\n勇敢的冒险者，恭喜你晋升为E级！\n请收下这份小小的礼物，继续勇往直前吧！\n————————————\n【恭喜 {} 晋升[E级冒险者]】\n【{} 获得[公会赠礼E]】".format(data["nickname"], data["nickname"])
                            with open(f"data/player/{uid}.txt", 'w') as f:
                                json.dump(data, f, ensure_ascii=False, indent=4)
                            await bag_add(uid, "公会赠礼E", 1)
                            await send_message(message, 0, 1, txt)
                            return
    
            elif rank == "E":
                if level < 25 or fame < 1000:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/25),声望({}/500)】".format(level, fame)
                else:
                    if not any(item['名称'] == '等级评定 D' for item in data["任务"]):
                        txt = "\n『狐狐』\n在乱石滩地栖息着巨大的刺毛猪。\n请前去击败它们证明自己吧！\n要记得保留新鲜的气息作为凭证哦！\n【任务目标】\n讨伐[刺毛猪](0/1)"
                        data["任务"].append({"名称": "等级评定 D", "来源": "冒险者公会", "类型": "等级评定", "目标": [{"类型": "讨伐", "对象": "刺毛猪", "数量": 1, "已讨伐": 0}], "奖励": "事件*晋升[D级冒险家]", "剩余时间": "无期限", "编码": 0})
                        with open(f"data/player/{uid}.txt", 'w') as f:
                            json.dump(data, f, ensure_ascii=False, indent=4)
                        await send_message(message, 0, 1, txt)
                        return
                    else:
                        item = next(item for item in data["任务"] if item['名称'] == '等级评定 D')
                        success = True
                        aim_txt = ""
                        for item_aim in item['目标']:
                            if item_aim["类型"] == "讨伐":
                                if item_aim["已讨伐"] < item_aim["数量"]:
                                    success = False
                                    aim_txt += "\n[{}]{}({}/{})".format(item_aim["类型"], item_aim["对象"], item_aim["已讨伐"], item_aim["数量"])
                            elif item_aim["类型"] == "收集":
                                have_number = await bag_number(uid, item_aim["对象"])
                                if have_number < item_aim["数量"]:
                                    success = False
                                    aim_txt += "\n[{}]{}({}/{})".format(item_aim["类型"], item_aim["对象"], have_number, item_aim["数量"])
                        if not success:
                            txt = "\n『狐狐』\n你还未完成相应要求哦~\n请先去完成再来吧！" + aim_txt
                            await send_message(message, 0, 1, txt)
                            return
                        else:
                            data["冒险者公会"]["等级"] = "D"
                            data["任务"] = [task for task in data["任务"] if task['名称'] != '等级评定 D']
                            txt = "\n『狐狐』\n勇敢的冒险者，恭喜你晋升为D级！\n请收下这份小小的礼物，继续勇往直前吧！\n————————————\n【恭喜 {} 晋升[D级冒险者]】\n【{} 获得[公会赠礼D]】".format(data["nickname"], data["nickname"])

                            with open(f"data/player/{uid}.txt", 'w') as f:
                                json.dump(data, f, ensure_ascii=False, indent=4)
                            await bag_add(uid, "公会赠礼D", 1)
                            await send_message(message, 0, 1, txt)
                            return
            elif rank == "D":
                if level < 35 or fame < 5000:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/35),声望({}/2000)】".format(level, fame)
            elif rank == "C":
                if level < 45 or fame < 20000:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/45),声望({}/5000)】".format(level, fame)
            elif rank == "B":
                if level < 55 or fame < 50000:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/55),声望({}/10000)】".format(level, fame)
            elif rank == "A":
                if level < 65 or fame < 100000:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/65),声望({}/20000)】".format(level, fame)
            elif rank == "S":
                if level < 75 or fame < 200000:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/75),声望({}/50000)】".format(level, fame)
            elif rank == "SS":
                if level < 85 or fame < 500000:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/85),声望({}/200000)】".format(level, fame)
            elif rank == "SSS":
                if level < 95 or fame < 2000000:
                    txt = "\n『狐狐』\n你还不满足下个评定的条件哦！\n继续努力吧！\n【等级({}/95),声望({}/1000000)】".format(level, fame)
            elif rank == "X":
                txt = "\n『狐狐』\n大佬，您已经是最高评级了哟！"
        else:
            txt = "\n『狐狐』\n你还不是公会的一员哦！\n请先加入公会吧！"
        await send_message(message, 0, 1, txt)
        return

    if player_place == "世界树2113" and str(message.content) == "1":
        if "够了" in await bag_enough(uid, "狐狐的推荐信", 1) or "够了" in await bag_enough(uid, "[噶]的联系方式", 1):
            txt = "\n『狐狐』\n“你去拜访过大学者[噶]了吗？”"
            await send_message(message, 0, 1, txt)
            return
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "任务" not in data:
            data["任务"] = []
        if_found = False
        task_ok = False
        for task in data["任务"]:
            if task["名称"] == "狐狐的推荐信" and task["类型"] == "等阶突破":
                if_found = True
                task_ok = True
                for task0 in task["目标"]:
                    if task0["类型"] == "收集":
                        if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                            task_ok = False
                    if task0["类型"] == "讨伐":
                        if int(task0["已讨伐"]) <  int(task0["数量"]):
                            task_ok = False
                break
        if if_found == True and task_ok == False:
            txt = "\n『狐狐』\n“杂鱼~\n给你的小小任务还没完成嘛~\n这是有多弱呀~”"
            await send_message(message, 0, 1, txt)
            return
        elif if_found == False and task_ok == False:
            data["任务"].append({"名称": "狐狐的推荐信", "来源": "狐狐", "类型": "等阶突破", "目标": [{"类型": "收集", "对象": "未知的精血", "数量": 10}, {"类型": "收集", "对象": "闪亮的精血", "数量": 1}], "奖励": "事件*获得[狐狐的推荐信]", "剩余时间": "无期限", "编码": 0})
            txt = "\n『狐狐』\n“听闻天空粉尘内部蕴含有隐晦的能量，它让诸多冒险者成功觉醒。”\n“然而人力终究是有限的，他们后来被卡在了第二道天堑上。”\n“在研究极限突破的这条路上，很多学者努力钻研，他们发现那些魔物拥有更高的极限。”\n“他们夜以继日前扑后继，终于窥察通往到更高等阶的途径。”\n“你可以去拜访大学者[噶]，他是这个领域的佼佼者，是不少强大冒险者的老师。”\n“不过。。。”\n“他貌似不怎么平易近人。。。”\n“这样，我可以给你写封推荐信，有了它你会方便很多。”\n“但是呢，你要帮我个小忙~”\n“怎么样？”\n————————————\n★接受任务★\n【收集[未知的精血]*10】\n【收集[闪亮的精血]*1】"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return
        elif if_found == True and task_ok == True:
            await bag_reduce(uid, "未知的精血", 10)
            await bag_reduce(uid, "闪亮的精血", 1)
            await bag_add(uid, "狐狐的推荐信", 1)
            txt = "\n『狐狐』\n“这就收集到了嘛~”\n“喏，推荐信我早就准备好啦。”\n她递给你一封金边蓝底的信笺。\n“在[世界图书馆]里有这位大学者的研究室，你可以去那儿拜访他。”\n————————————\n【{} 获得[狐狐的推荐信]】".format(data["nickname"])
            data["任务"] = [task for task in data["任务"] if task['名称'] != '狐狐的推荐信']
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return


        await send_message(message, 0, 1, txt)
        return


    elif player_place == "世界树2114" and str(message.content) == "开始打工":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if int(data["等级"]) < 20:
            txt = "\n【冒险者公会•前台】\n『狐狐』\n“你这小身板太弱了哦！”\n“20级后再来吧！”"
            await send_message(message, 0, 1, txt)
            return
        timestamp = int(time.time())
        data["打工信息"] = {"打工地点": "冒险者公会", "打工时间": timestamp, "打工等级": data["等级"]}
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        await txt_write("player", "number", number, "状态", "打工")
        txt = "\n【冒险者公会•前台】\n『狐狐』\n“进那个门左转再右转就是演武厅~”\n“努力工作吧！”\n————————————\n【发送[结束工作]结束】"
        await send_message(message, 0, 1, txt)
        return
    

    elif player_place == "世界树212" and str(message.content) == "1":
        with open(f"data/冒险者公会_委托板.txt", 'r') as f:
            data = json.load(f)
        txt = "【冒险者公会•委托板】"
        for index, item in enumerate(data["当前"]):
            txt0 = ""
            for item0 in item["目标"]:
                txt0 += "\n      ".join(["{}[{}] × {}".format(item0["类型"], item0["对象"], item0["数量"]) for item0 in item["目标"]])
            reward = item["奖励"].replace("+", "、")
            txt += "\n【{}】{}\n类型：{}\n目标：{}\n奖励：{}\n剩余时间：{}".format(str(index + 1), item["名称"], item["类型"], txt0, reward, item["剩余时间"])
        txt += "\n————————————\n发送[接受委托 编号]接受任务\n发送[提交委托 编号] 提交任务\n可以[一键接受委托]了"
        await send_message(message, 0, 1, txt)
        return

    elif player_place == "世界树212" and "接受委托" in str(message.content):
        all_in = False
        if "一键接受委托" in str(message.content):
            all_in = True
        with open(f"data/冒险者公会_委托板.txt", 'r') as f:
            data = json.load(f)
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        if "冒险者公会" not in player_data:
            txt = "\n【非公会人员不可提交哦！】"
            await send_message(message, 0, 1, txt)
            return
        if not all_in:
            task_number = int(message.content.split("接受委托")[1])
            if task_number > len(data["当前"]):
                txt = "\n【当前只存在个{}委托！】".format(len(data["当前"]))
                await send_message(message, 0, 1, txt)
                return
            elif task_number <= len(data["当前"]):
                task = data["当前"][int(task_number - 1)]
            else:
                txt = "\n【委托指令错误！】\n示例：[接受委托1]"
                await send_message(message, 0, 1, txt)
                return

            if any(item['编码'] == task['编码'] for item in player_data["任务"]):
                txt = "\n【你已经接受过该委托！】\n发送[我的任务]查看"
                await send_message(message, 0, 1, txt)
                return
            task_txt = ""
            for task_aim in task['目标']:
                if task_aim["类型"] == "讨伐":
                    task_aim["已讨伐"] = 0
                    if task_aim["已讨伐"] < task_aim["数量"]:
                        task_txt += "\n    [{}]{}({}/{})".format(task_aim["类型"], task_aim["对象"], task_aim["已讨伐"], task_aim["数量"])
                elif task_aim["类型"] == "收集":
                    have_number = int(await bag_number(uid, task_aim["对象"]))
                    if have_number < task_aim["数量"]:
                        task_txt += "\n    [{}]{}({}/{})".format(task_aim["类型"], task_aim["对象"], have_number, task_aim["数量"])
            reward = task["奖励"].replace("+", "、")
            txt = "\n【你接受了委托[{}]】\n委托方：{}\n委托内容：{}\n奖励：{}".format(task['名称'], task['来源'], task_txt, reward)
            player_data["任务"].append(task)

        else:
            for task in data["当前"]:
                if any(item['编码'] == task['编码'] for item in player_data["任务"]):
                    continue
                else:
                    for task_aim in task['目标']:
                        if task_aim["类型"] == "讨伐":
                            task_aim["已讨伐"] = 0
                    player_data["任务"].append(task)

            new_tasks = []
            for task in player_data["任务"]:
                if task not in new_tasks:
                    new_tasks.append(task)
            player_data["任务"] = new_tasks

            txt = "\n【你接受了全部的委托】"

        txt += "\n————————————\n【发送[任务]查看详情】"
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(player_data, f, ensure_ascii=False, indent=4)
        await send_message(message, 0, 1, txt)
        return

    elif player_place == "世界树212" and "提交委托" in str(message.content):

        with open(f"data/冒险者公会_委托板.txt", 'r') as f:
            data = json.load(f)
        with open(f"data/player/{uid}.txt", 'r') as f:
            player_data = json.load(f)
        if "冒险者公会" not in player_data:
            txt = "\n【非公会人员不可提交哦！】"
            await send_message(message, 0, 1, txt)
            return
        task_number = int(message.content.split("提交委托")[1])
        if task_number > len(data["当前"]):
            txt = "\n【当前只存在个{}委托！】".format(len(data["当前"]))
            await send_message(message, 0, 1, txt)
            return
        elif task_number <= len(data["当前"]):
            task = data["当前"][int(task_number - 1)]
        else:
            txt = "\n【委托指令错误！】\n示例：[接受委托1]"
            await send_message(message, 0, 1, txt)
            return
        if not any(item['编码'] == task['编码'] for item in player_data["任务"]):
            txt = "\n【你尚未接受过该委托！】\n请先[接受委托{}]".format(task_number)
            await send_message(message, 0, 1, txt)
            return
        task_id = task["编码"]
        task = next(item for item in player_data["任务"] if item['编码'] == task_id)
        if task.get("是否完成", "否") == "是":
            txt = "\n【请勿重复提交委托！】".format(task_number)
            await send_message(message, 0, 1, txt)
            return
        success = True
        task_txt = ""
        for task_aim in task['目标']:
            if task_aim["类型"] == "讨伐":
                if task_aim["已讨伐"] < task_aim["数量"]:
                    success = False
                    task_txt += "    \n[{}]{}({}/{})".format(task_aim["类型"], task_aim["对象"], task_aim["已讨伐"], task_aim["数量"])
            elif task_aim["类型"] == "收集":
                have_number = int(await bag_number(uid, task_aim["对象"]))
                if have_number < task_aim["数量"]:
                    success = False
                    task_txt += "    \n[{}]{}({}/{})".format(task_aim["类型"], task_aim["对象"], have_number, task_aim["数量"])

        if success:
            for task_aim in task['目标']:
                if task_aim["类型"] == "收集":
                    await bag_reduce(uid, task_aim["对象"], task_aim["数量"])
            rewards = task["奖励"].split("+")
            reward_txt = ""
            for reward in rewards:
                reward0 = reward.split("*")
                if reward0[0] == "声望":
                    reward_txt += "\n    声望[{}]点".format(reward0[1])
                    player_data["冒险者公会"]["声望"] += int(reward0[1])
                else:
                    reward_txt += "\n    [{}] × {}".format(reward0[0], reward0[1])
                    await bag_add(uid, reward0[0], reward0[1])
            txt = "\n【你完成了委托[{}]】\n获得奖励：{}".format(task['名称'], reward_txt)
            task["是否完成"] = "是"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(player_data, f, ensure_ascii=False, indent=4)
#            with open("data/冒险者公会_委托板.txt", 'w') as f:
#                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return
        else:
            txt = "\n【你尚未满足委托条件！】\n目标：{}".format(task_txt)
            await send_message(message, 0, 1, txt)
            return


    if player_place == "世界树222" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "不够" in await bag_enough(uid, "狐狐的推荐信", 1) and "不够" in await bag_enough(uid, "[噶]的联系方式", 1) and not any(data_task["名称"] == "[噶]的试炼" for data_task in data["任务"]):
            txt = "\n门内传来冷漠的声音。\n“暂不接客！！！”"
            await send_message(message, 0, 1, txt)
            return
        elif not any(data_task["名称"] == "[噶]的试炼" for data_task in data["任务"]) and "够了" in await bag_enough(uid, "狐狐的推荐信", 1):
            txt = "\n你说明了来意后，并将手中的推荐信呈上。\n“你是她介绍来的啊。”\n门户缓缓大开，随即映入眼帘的是一张无比精致的脸庞。\n她不动声色的将你领到一张古朴的木桌前，请你入座。\n她为你泡了一杯茶水，你小抿了一口，甚是苦涩。\n沉默了片刻，她率先开了口：\n“我相信你很震惊，我为何如此年轻。但实际上，我已经108岁了。”\n“什么！！！”\n“你的来意在推荐信里已经阐明，本来我想拒绝。但由于你是她介绍而来，我不好推脱。”\n[噶]不合时宜的咳嗽了几声，似乎身体有些虚弱，\n“我这些年的研究，的确勘破了突破的奥秘。但我要事先提醒你一句，世间可没有免费的午餐，所有的力量必将付出代价。”\n“呵~代价？”你轻笑了一声，“我从异世界穿越而来，本就无牵无挂。但如果自己都不能保护自己，如果不能达到这世间的极致，我又如何寻找莅临此处的意义！”\n她看到了你目光中坚定地信念。\n“说的好！既然如此，那我便不多言。”\n她右手一挥，从虚空中撺掇出一把深蓝色的长杖，蕴含着隐晦的磅礴能量。\n“我不欺负你，你也尽管去寻些帮手！我会压制我的力量——”\n“击败我！”\n“让我看看你的信念是否如你所说的那样强大！！！”\n————————————\n★接受任务★\n【击败 大学者[噶]】"
            if "任务" not in data:
                data["任务"] = []
            data["任务"].append({"名称": "[噶]的试炼", "来源": "噶", "类型": "等阶突破", "目标": [{"类型": "讨伐", "对象": "大学者[噶]", "数量": 1, "已讨伐": 0}], "奖励": "事件*[等阶突破的奥秘]", "剩余时间": "无期限", "编码": 0})
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await bag_reduce(uid, "狐狐的推荐信", 1)
            await bag_add(uid, "[噶]的联系方式", 1)
            await send_message(message, 0, 1, txt)
            return

    if player_place == "世界树2221" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "任务" not in data:
            data["任务"] = []
        if_found = False
        task_ok = False
        for task in data["任务"]:
            if task["名称"] == "[噶]的试炼" and task["类型"] == "等阶突破":
                if_found = True
                task_ok = True
                for task0 in task["目标"]:
                    if task0["类型"] == "讨伐":
                        if int(task0["已讨伐"]) <  int(task0["数量"]):
                            task_ok = False
                break
        if if_found == True and task_ok == False:
            txt = "\n『噶』\n“终于。。。”\n“你准备好了吗？”\n“一起来见证你配不配拥有进化后的力量！”\n————————————\n⚔战斗开始⚔\n【大学者[噶]】Lv.25\n◇战斗面板\n◇普攻\n◇技能x\n◇道具x"
            await send_message(message, 0, 1, txt)
            await battle_initialization("大学者[噶]", 25, message, "神圣")
            return


        elif if_found == False and task_ok == False:
            txt = "\n『噶』\n“我已经没有能传授你的了。”"
            await send_message(message, 0, 1, txt)
            return
 
        elif if_found == True and task_ok == True:
            await bag_add(uid, "进化之种", 1)
            txt = "\n『噶』\n“做的不错！我感受到了你坚定的信念。”\n“来，拿上这个——”\n她小心翼翼的颁给你一个木盒。\n你打开它，里面一颗金色的圆珠晶莹剔透。\n“这是开启进化的种子，你用心去感悟，一定可以窥得通往更高层次的奥秘。”\n“不过记住，一旦踏上这条路，就再也无法回头！！！”\n————————————\n【{} 获得[进化之种]】".format(data["nickname"])
            data["任务"] = [task for task in data["任务"] if task['名称'] != '[噶]的试炼']
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return

    if player_place == "世界树2221" and str(message.content) == "2":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "任务" not in data:
            data["任务"] = []
        task_number = data["每日任务记录"].get("[噶]的委托", 0)
        if task_number != 0:
            txt = "\n『噶』\n“我的材料已经够用了。”\n“请明日再来吧！”"
            await send_message(message, 0, 1, txt)
            return
        if_found = False
        task_ok = False
        for task in data["任务"]:
            if task["名称"] == "[噶]的委托" and task["类型"] == "每日":
                if_found = True
                task_ok = True
                for task0 in task["目标"]:
                    if task0["类型"] == "收集":
                        if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                            task_ok = False
                break
        if if_found == True and task_ok == False:
            txt = "\n『噶』\n“这点材料可不够我每日研究的哦！”"
            await send_message(message, 0, 1, txt)
            return
        elif if_found == False and task_ok == False:
            data["任务"].append({"名称": "[噶]的委托", "来源": "噶", "类型": "每日", "目标": [{"类型": "收集", "对象": "淡绿色精血", "数量": 1}, {"类型": "收集", "对象": "淡黄色精血", "数量": 1}, {"类型": "收集", "对象": "淡红色精血", "数量": 1}, {"类型": "收集", "对象": "淡蓝色精血", "数量": 1}, {"类型": "收集", "对象": "天空粉尘", "数量": 1}, {"类型": "收集", "对象": "血肉残骸", "数量": 3}, {"类型": "收集", "对象": "能量余辉", "数量": 3}], "奖励": "事件*随机进化灵药", "剩余时间": "无期限", "编码": 0})
            txt = "\n『噶』\n“去帮我收集这些材料吧！”\n“有了它们，我的研究将会更进一步。”\n“我会给你正在研究的进化灵药作为报酬。”\n“当然，进化的力量是可怕的，请谨慎使用！”\n★接受任务★\n收集[巨魔精血]*3、[哥布林精血]*3、[血肉残骸]*3、[能量余辉]*3、[天空粉尘]*1"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return
        elif if_found == True and task_ok == True:
            await bag_reduce(uid, "淡绿色精血", 1)
            await bag_reduce(uid, "淡黄色精血", 1)
            await bag_reduce(uid, "淡红色精血", 1)
            await bag_reduce(uid, "淡蓝色精血", 1)
            await bag_reduce(uid, "天空粉尘", 1)
            await bag_reduce(uid, "血肉残骸", 3)
            await bag_reduce(uid, "能量余辉", 3)
            reward_name = random.choice(["进化灵药α", "进化灵药β", "进化灵药γ"])
            await bag_add(uid, reward_name, 1)
            txt = "\n『噶』\n“做的很好！”\n“接下来，我要去研究了。”\n“这是你的报酬，请收好——”\n————————————\n【获得[{}]】".format(reward_name)
            data["任务"] = [task for task in data["任务"] if task['名称'] != '[噶]的委托']
            data["每日任务记录"]["[噶]的委托"] = 1
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return


    elif player_place == "世界树241" and str(message.content) == "开始打工":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if int(data["等级"]) < 10:
            txt = "\n【世界传送门】\n『传送门守卫』\n“瞧你弱不禁风的样子！”\n“10级才有资格站在这儿！”"
            await send_message(message, 0, 1, txt)
            return
        timestamp = int(time.time())
        data["打工信息"] = {"打工地点": "世界传送门", "打工时间": timestamp, "打工等级": data["等级"]}
        with open(f"data/player/{uid}.txt", 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
        await txt_write("player", "number", number, "状态", "打工")
        txt = "\n【世界传送门】\n『传送门守卫』\n“站好每一班岗是我们的职责所在！”\n“盯紧了！不法之徒随时都有可能出现！”\n————————————\n【发送[结束工作]结束】"
        await send_message(message, 0, 1, txt)
        return


    elif player_place == "世界树31111" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "一转" in data:
            if data["一转"] != "":
                txt = "\n【你已经转职过了哟！】"
                await send_message(message, 0, 1, txt)
                return
        elif int(data["等级"]) < 10:
            txt = "\n【请10级后再来哟！】"
            await send_message(message, 0, 1, txt)
            return
        else:
            data["一转"] = "战士"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            txt = "\n一道血红的气息涌入你的身体，你感觉浑身充满了力量。\n【转职★战士★成功！】"
            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树31121" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "一转" in data:
            txt = "\n【你已经转职过了哟！】"
            await send_message(message, 0, 1, txt)
            return
        elif int(data["等级"]) < 10:
            txt = "\n【请10级后再来哟！】"
            await send_message(message, 0, 1, txt)
            return
        else:
            data["一转"] = "盾守"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            txt = "\n一道血红的气息涌入你的身体，你感觉身体愈加强壮。\n【转职★盾守★成功！】"
            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树3121" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "一转" in data:
            txt = "\n【你已经转职过了哟！】"
            await send_message(message, 0, 1, txt)
            return
        elif int(data["等级"]) < 10:
            txt = "\n【请10级后再来哟！】"
            await send_message(message, 0, 1, txt)
            return
        else:
            data["一转"] = "法师"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            txt = "\n一抹蓝光映入你的脑海。\n自此，你已经能够察觉到元素的踪迹。\n【转职★法师★成功！】"
            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树3131" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "一转" in data:
            txt = "\n【你已经转职过了哟！】"
            await send_message(message, 0, 1, txt)
            return
        elif int(data["等级"]) < 10:
            txt = "\n【请10级后再来哟！】"
            await send_message(message, 0, 1, txt)
            return
        else:
            data["一转"] = "牧师"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            txt = "\n天顶打下一片圣洁的白光将你笼罩，无数的生机涌入了你的身躯。\n你感觉到身体在蜕变。\n【转职★牧师★成功！】"
            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树3141" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "一转" in data:
            txt = "\n【你已经转职过了哟！】"
            await send_message(message, 0, 1, txt)
            return
        elif int(data["等级"]) < 10:
            txt = "\n【请10级后再来哟！】"
            await send_message(message, 0, 1, txt)
            return
        else:
            data["一转"] = "刺客"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            txt = "\n“虚空注视着你————”\n耳边传来隐晦的话语，你竟察觉到自己变得更加敏锐而又轻盈。\n【转职★刺客★成功！】"
            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树31112" and (str(message.content) == "1" or str(message.content) == "2"):
        if str(message.content) == "1":
            skill = "生命吸收"
        elif str(message.content) == "2":
            skill = "洪荒之力"
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if data.get("一转", "") != "战士":
            txt = "\n【该技能只有[战士]可以学习！】"
            await send_message(message, 0, 1, txt)
            return
        elif any(spell["名称"] == skill for spell in data["学会技能"]):
            new_learn = False
        else:
            new_learn = True
        
        need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
        skill_all = data["学会技能"]
        skill_level = int(([skill_list0["等级"] for skill_list0 in skill_all if skill_list0["名称"] == skill] or [0])[0])
        thing = list(need.keys())[skill_level]
        number = list(need.values())[skill_level]
        if str(message.content) == "2":
            number *= 10
        
        lack_txt = await bag_enough(uid, thing, number)
        if "不够" in lack_txt:
            lack_number = lack_txt.split("*缺")[1]
            txt = "\n【你没有足够的贡品！】\n◈缺少[{}]×{}".format(thing, lack_number)
            await send_message(message, 0, 1, txt)
            return
        else:
            if new_learn:
                data["学会技能"].append({"名称": skill, "等级": 1, "熟练度": 0})
                txt = "\n一道金光映入你的脑海。\n【你领悟到了[{}]】".format(skill)
            else:
                for skill_item in data["学会技能"]:
                    if skill_item["名称"] == skill:
                        skill_item["等级"] += 1
                        break
                txt = "\n神圣的光辉将你笼罩——\n【你加深了对[{}]的领悟】".format(skill)
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            if str(message.content) == "1":
                await bag_reduce(uid, thing, number)
            elif str(message.content) == "2":
                await bag_reduce(uid, thing, number)

            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树31122" and (str(message.content) == "1" or str(message.content) == "2"):
        if str(message.content) == "1":
            skill = "生命涓流"
        elif str(message.content) == "2":
            skill = "不灭意志"
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if data.get("一转", "") != "盾守":
            txt = "\n【该技能只有[盾守]可以学习！】"
            await send_message(message, 0, 1, txt)
            return
        elif any(spell["名称"] == skill for spell in data["学会技能"]):
            new_learn = False
        else:
            new_learn = True
        
        need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
        skill_all = data["学会技能"]
        skill_level = int(([skill_list0["等级"] for skill_list0 in skill_all if skill_list0["名称"] == skill] or [0])[0])
        thing = list(need.keys())[skill_level]
        number = list(need.values())[skill_level]
        if str(message.content) == "2":
            number *= 10
        
        lack_txt = await bag_enough(uid, thing, number)
        if "不够" in lack_txt:
            lack_number = lack_txt.split("*缺")[1]
            txt = "\n【你没有足够的贡品！】\n◈缺少[{}]×{}".format(thing, lack_number)
            await send_message(message, 0, 1, txt)
            return
        else:
            if new_learn:
                data["学会技能"].append({"名称": skill, "等级": 1, "熟练度": 0})
                txt = "\n一道金光映入你的脑海。\n【你领悟到了[{}]】".format(skill)
            else:
                for skill_item in data["学会技能"]:
                    if skill_item["名称"] == skill:
                        skill_item["等级"] += 1
                        break
                txt = "\n神圣的光辉将你笼罩——\n【你加深了对[{}]的领悟】".format(skill)
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            if str(message.content) == "1":
                await bag_reduce(uid, thing, number)
            elif str(message.content) == "2":
                await bag_reduce(uid, thing, number)

            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树3122" and (str(message.content) == "1" or str(message.content) == "2"):
        if str(message.content) == "1":
            skill = "魔力涌动"
        elif str(message.content) == "2":
            skill = "元素爆发"
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if data.get("一转", "") != "法师":
            txt = "\n【该技能只有[法师]可以学习！】"
            await send_message(message, 0, 1, txt)
            return
        elif any(spell["名称"] == skill for spell in data["学会技能"]):
            new_learn = False
        else:
            new_learn = True
        
        need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
        skill_all = data["学会技能"]
        skill_level = int(([skill_list0["等级"] for skill_list0 in skill_all if skill_list0["名称"] == skill] or [0])[0])
        thing = list(need.keys())[skill_level]
        number = list(need.values())[skill_level]
        if str(message.content) == "2":
            number *= 10
        
        lack_txt = await bag_enough(uid, thing, number)
        if "不够" in lack_txt:
            lack_number = lack_txt.split("*缺")[1]
            txt = "\n【你没有足够的贡品！】\n◈缺少[{}]×{}".format(thing, lack_number)
            await send_message(message, 0, 1, txt)
            return
        else:
            if new_learn:
                data["学会技能"].append({"名称": skill, "等级": 1, "熟练度": 0})
                txt = "\n一道金光映入你的脑海。\n【你领悟到了[{}]】".format(skill)
            else:
                for skill_item in data["学会技能"]:
                    if skill_item["名称"] == skill:
                        skill_item["等级"] += 1
                        break
                txt = "\n神圣的光辉将你笼罩——\n【你加深了对[{}]的领悟】".format(skill)
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            if str(message.content) == "1":
                await bag_reduce(uid, thing, number)
            elif str(message.content) == "2":
                await bag_reduce(uid, thing, number)

            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树3132" and (str(message.content) == "1" or str(message.content) == "2"):
        if str(message.content) == "1":
            skill = "医者仁心"
        elif str(message.content) == "2":
            skill = "律者箴言"
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if data.get("一转", "") != "牧师":
            txt = "\n【该技能只有[牧师]可以学习！】"
            await send_message(message, 0, 1, txt)
            return
        elif any(spell["名称"] == skill for spell in data["学会技能"]):
            new_learn = False
        else:
            new_learn = True
        
        need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
        skill_all = data["学会技能"]
        skill_level = int(([skill_list0["等级"] for skill_list0 in skill_all if skill_list0["名称"] == skill] or [0])[0])
        thing = list(need.keys())[skill_level]
        number = list(need.values())[skill_level]
        if str(message.content) == "2":
            number *= 10
        
        lack_txt = await bag_enough(uid, thing, number)
        if "不够" in lack_txt:
            lack_number = lack_txt.split("*缺")[1]
            txt = "\n【你没有足够的贡品！】\n◈缺少[{}]×{}".format(thing, lack_number)
            await send_message(message, 0, 1, txt)
            return
        else:
            if new_learn:
                data["学会技能"].append({"名称": skill, "等级": 1, "熟练度": 0})
                txt = "\n一道金光映入你的脑海。\n【你领悟到了[{}]】".format(skill)
            else:
                for skill_item in data["学会技能"]:
                    if skill_item["名称"] == skill:
                        skill_item["等级"] += 1
                        break
                txt = "\n神圣的光辉将你笼罩——\n【你加深了对[{}]的领悟】".format(skill)
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            if str(message.content) == "1":
                await bag_reduce(uid, thing, number)
            elif str(message.content) == "2":
                await bag_reduce(uid, thing, number)

            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树3142" and (str(message.content) == "1" or str(message.content) == "2"):
        if str(message.content) == "1":
            skill = "杀意感知"
        elif str(message.content) == "2":
            skill = "弱点洞察"
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if data.get("一转", "") != "刺客":
            txt = "\n【该技能只有[刺客]可以学习！】"
            await send_message(message, 0, 1, txt)
            return
        elif any(spell["名称"] == skill for spell in data["学会技能"]):
            new_learn = False
        else:
            new_learn = True
        
        need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
        skill_all = data["学会技能"]
        skill_level = int(([skill_list0["等级"] for skill_list0 in skill_all if skill_list0["名称"] == skill] or [0])[0])
        thing = list(need.keys())[skill_level]
        number = list(need.values())[skill_level]
        if str(message.content) == "2":
            number *= 10
        
        lack_txt = await bag_enough(uid, thing, number)
        if "不够" in lack_txt:
            lack_number = lack_txt.split("*缺")[1]
            txt = "\n【你没有足够的贡品！】\n◈缺少[{}]×{}".format(thing, lack_number)
            await send_message(message, 0, 1, txt)
            return
        else:
            if new_learn:
                data["学会技能"].append({"名称": skill, "等级": 1, "熟练度": 0})
                txt = "\n一道金光映入你的脑海。\n【你领悟到了[{}]】".format(skill)
            else:
                for skill_item in data["学会技能"]:
                    if skill_item["名称"] == skill:
                        skill_item["等级"] += 1
                        break
                txt = "\n神圣的光辉将你笼罩——\n【你加深了对[{}]的领悟】".format(skill)
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            if str(message.content) == "1":
                await bag_reduce(uid, thing, number)
            elif str(message.content) == "2":
                await bag_reduce(uid, thing, number)

            await send_message(message, 0, 1, txt)
            return


    elif player_place == "世界树1212" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "副职业" in data:
            if data["副职业"]:
                txt = "\n『漠北』\n“打铁可不能三心二意！”"
                await send_message(message, 0, 1, txt)
                return
        if "任务" not in data:
            data["任务"] = []
        if_found = False
        task_ok = False
        for task in data["任务"]:
            if task["名称"] == "初识锻造" and task["类型"] == "副职业":
                if_found = True
                task_ok = True
                for task0 in task["目标"]:
                    if task0["类型"] == "收集":
                        if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                            task_ok = False
                    if task0["类型"] == "讨伐":
                        if int(task0["已讨伐"]) <  int(task0["数量"]):
                            task_ok = False
                break
        if if_found == True and task_ok == False:
            txt = "\n『漠北』\n“就这点材料，你莫不是糊弄洒家？”"
            await send_message(message, 0, 1, txt)
            return
        elif if_found == False and task_ok == False:
            data["任务"].append({"名称": "初识锻造", "来源": "漠北", "类型": "副职业", "目标": [{"类型": "收集", "对象": "白晶", "数量": 3}, {"类型": "收集", "对象": "绿晶", "数量": 1}], "奖励": "事件*转职[锻造师]", "剩余时间": "无期限", "编码": 0})
            txt = "\n『漠北』\n“打铁，可不是容易的工作！”\n“不仅对个人技艺有着极高的要求，锻材也是不可或缺的内容。”\n“先考验考验你，去吧这些材料寻来吧！”\n★接受任务★\n收集[白晶]*3 、[绿晶]*1"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return
        elif if_found == True and task_ok == True:
            await bag_reduce(uid, "白晶", 3)
            await bag_reduce(uid, "绿晶", 1)
            await bag_add(uid, "漠北的赠礼", 1)
            txt = "\n『漠北』\n“年轻人，好样的！”\n“既然你有这能力，那我也不吝啬自己的技艺。”\n他将一块黑不溜秋的铁胚放入锻炉，加入了你带来的神秘晶体。\n他也不急躁，坐一旁悠哉的哼着小曲。直到察觉火候足了，才缓缓站起身。\n他将滚烫的铁水倒入模具，没一会儿功夫，一柄剑的外观初具雏形。\n“记准接下来我的手法！”\n他将依然红温的锻胚夹上锻台，粗而有力的臂膀一锤锤抡上去，发出尖锐而又颇具节奏的敲打声。\n一共九九八十一锤，每一锤的角度都无比精准，最终构成了一把杰作。\n最终淬火的那一瞬间，武器散发出内敛的光彩。\n“呼，年轻人，如何？”\n————————————\n【恭喜 {} 成为了[锻造师]🛠️】\n【{} 获得[漠北的赠礼]】".format(data["nickname"], data["nickname"])
            data["副职业"].append({"副职业": "锻造师", "等级": 0, "熟练度": 0, "熟练度上限": 100, "精力": 200, "精力上限": 200, "装备": {"熔炉": "", "锻锤": "", "锻具": ""}, "配方": []})
            data["任务"] = [task for task in data["任务"] if task['名称'] != '初识锻造']
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return


    elif player_place == "世界树1312" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "副职业" in data:
            if data["副职业"]:
                txt = "\n『晴儿』\n(皱眉)\n“不要三心二意哟！”"
                await send_message(message, 0, 1, txt)
                return
        if "任务" not in data:
            data["任务"] = []
        if_found = False
        task_ok = False
        for task in data["任务"]:
            if task["名称"] == "初识炼金" and task["类型"] == "副职业":
                if_found = True
                task_ok = True
                for task0 in task["目标"]:
                    if task0["类型"] == "收集":
                        if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                            task_ok = False
                    if task0["类型"] == "讨伐":
                        if int(task0["已讨伐"]) <  int(task0["数量"]):
                            task_ok = False
                break
        if if_found == True and task_ok == False:
            txt = "\n『晴儿』\n“啊咧，你收集的还不够哟”"
            await send_message(message, 0, 1, txt)
            return
        elif if_found == False and task_ok == False:
            data["任务"].append({"名称": "初识炼金", "来源": "晴儿", "类型": "副职业", "目标": [{"类型": "收集", "对象": "血肉残骸", "数量": 5}, {"类型": "收集", "对象": "能量余辉", "数量": 1}], "奖励": "事件*转职[炼金师]", "剩余时间": "无期限", "编码": 0})
            txt = "\n『晴儿』\n“想要炼金的话，高级的材料不可缺少呢”\n“我这有一个初级药剂制作配方，你去帮我收集一些材料吧！”\n她递出了一张清单。\n★接受任务★\n收集[血肉残骸]*5 、[能量余辉]*1"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return
        elif if_found == True and task_ok == True:
            await bag_reduce(uid, "血肉碎块", 5)
            await bag_reduce(uid, "能量凝胶", 1)
            await bag_add(uid, "晴儿的赠礼", 1)
            txt = "\n『晴儿』\n“很不错嘛，这就集齐了耶”\n她接过材料，只向双空中轻轻一抛便悬浮于空中。\n“要开始了，你准备好了吗~”\n一丝丝精神念力在空中缭绕，那些材料缓缓溶解，凝成了几颗色彩斑斓的小球。\n“看仔细了哟————”\n小球开始靠近凝聚，一开始还稍微排斥，到最终还是融为了一体。凝聚而成的液体里蕴含着不一般的能量。\n晴儿倏的一挥手，金红色的液体已然收入瓶中。\n“嘿嘿，你领悟到了吗？”\n(微笑)\n“是不是很简单呢~”\n————————————\n【恭喜 {} 成为了[炼金师]⚗️】\n【{} 获得[晴儿的赠礼]】".format(data["nickname"], data["nickname"])
            data["副职业"].append({"副职业": "炼金师", "等级": 0, "熟练度": 0, "熟练度上限": 100, "精力": 200, "精力上限": 200, "装备": {"容器": "", "工具": "", "助具": ""}, "配方": []})
            data["任务"] = [task for task in data["任务"] if task['名称'] != '初识炼金']
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return

    elif player_place == "世界树1412" and str(message.content) == "1":
        with open(f"data/player/{uid}.txt", 'r') as f:
            data = json.load(f)
        if "副职业" in data:
            if data["副职业"]:
                txt = "\n『小茗』\n“你不满足条件啦！”"
                await send_message(message, 0, 1, txt)
                return
        if "任务" not in data:
            data["任务"] = []
        if_found = False
        task_ok = False
        for task in data["任务"]:
            if task["名称"] == "初识分解" and task["类型"] == "副职业":
                if_found = True
                task_ok = True
                for task0 in task["目标"]:
                    if task0["类型"] == "收集":
                        if "不够" in await bag_enough(uid, task0["对象"], int(task0["数量"])):
                            task_ok = False
                    if task0["类型"] == "讨伐":
                        if int(task0["已讨伐"]) <  int(task0["数量"]):
                            task_ok = False
                break
        if if_found == True and task_ok == False:
            txt = "\n『小茗』\n“客人，别来开我玩笑了吖”"
            await send_message(message, 0, 1, txt)
            return
        elif if_found == False and task_ok == False:
            data["任务"].append({"名称": "初识分解", "来源": "小茗", "类型": "副职业", "目标": [{"类型": "收集", "对象": "大兽肉", "数量": 5}], "奖励": "事件*转职[分解师]", "剩余时间": "无期限", "编码": 0})
            txt = "\n『小茗』\n“想要分解的话，最好使用不一般的原材料呢。分解的原料越高级，带给你的惊喜就会越大~”\n“先帮我收集这些吧！”\n★接受任务★\n【收集[大兽肉]*5】"
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return
        elif if_found == True and task_ok == True:
            await bag_reduce(uid, "大兽肉", 5)
            await bag_add(uid, "小茗的赠礼", 1)
            txt = "\n『小茗』\n“哇耶，这些肉品质很不错嘛。稍等稍等~”\n她麻溜的打开抽屉，小心翼翼的去处一把看上去奇形怪状的刀。\n“想要分解出珍稀的材料，趁手的工具可不能少。瞧，我前些天刚打造的分解刀，顶级琉璃钢材质的哩！”\n语气中洋溢着一丝得意。\n“接下来注意啦！我要开始了！”\n她将材料放在台上，左手轻拈，一丝淡金色的脉络在表面蔓延。\n她的视线无比专注，右手的刀刃顺着脉络轻移，及其沉稳没有半点偏差。\n你沉住气仔细地观望。\n不一会儿，那些材料已然变成了一小堆能量四溢的事物。\n“喏，不错吧！今天我可是超常发挥了！”\n她得意洋洋的开口。\n“若是还有不懂的地方，可以再来请教我哟！”\n————————————\n【恭喜 {} 成为了[分解师]🪚】\n【{} 获得[小茗的赠礼]】".format(data["nickname"], data["nickname"])
            data["副职业"].append({"副职业": "分解师", "等级": 0, "熟练度": 0, "熟练度上限": 100, "精力": 200, "精力上限": 200, "装备": {"工作台": "", "工具": "", "助具": ""}})
            data["任务"] = [task for task in data["任务"] if task['名称'] != '初识分解']
            with open(f"data/player/{uid}.txt", 'w') as f:
                json.dump(data, f, ensure_ascii=False, indent=4)
            await send_message(message, 0, 1, txt)
            return


        
                    




    if_act = True
    try:
        if int(message.content) not in can_action:
            txt = "\n【此路不通！】"
            await send_message(message, 0, 1, txt)
            return
        if int(message.content) == 0:
            player_place = player_place[:-1]
        else:
            player_place = player_place + str(message.content)
    except ValueError:
        pass
    
    
    await txt_write("player", "number", number, "地名", player_place)
    if player_place == "世界树":
        txt = "\n【大陆枢纽•世界树】\n盘根错节，舞蛟苍虬。\n脉络亘撒，窥古通今。\n琼枝弄顶，问津寥人。\n枝繁花茂，脍炙众生。\n◈[1] 前往 世界树下层\n◈[2] 前往 世界树中层\n◈[3] 前往 世界树上层\n◈[4] 前往 世界树顶层\n◈[5] 前往 世界树地下\n————————————\n发送[1][2][3][4][5]进行操作"
        await send_message(message, 0, 1, txt)
        return
    else:
        place_number_now = player_place.split("世界树")[1]
        if place_number_now == "1":
            txt = "\n【世界树•下层】\n人流量最密集，最热闹的地方。\n◈[1] 前往 坊市\n◈[2] 前往 铁匠铺\n◈[3] 前往 炼金所\n◈[4] 前往 工具屋\n◈[5] 前往 宠物店\n◈[0] 返回\n————————————\n发送[1][2][3][4][5][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "2":
            txt = "\n【世界树•中层】\n通天彻地，中流砥柱。\n◈[1] 前往 冒险者公会\n◈[2] 前往 世界图书馆\n◈[3] 前往 拍卖行\n◈[4] 前往 世界传送门\n◈[5] 未知\n◈[0] 返回\n————————————\n发送[1][2][3][4][5][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3":
            txt = "\n【世界树•上层】\n烟雾缭绕，已至云端。\n◈[1] 前往 诸神殿堂\n◈[2] 未知\n◈[3] 未知\n◈[4] 未知\n◈[5] 未知\n◈[0] 返回\n————————————\n发送[1][2][3][4][5][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "4":
            txt = "\n【世界树•顶层】\n云海之上。\n◈[1] 前往 穹窿秘境\n◈[2] 前往 混沌之门\n◈[3] 未知\n◈[4] 未知\n◈[5] 未知\n◈[0] 返回\n————————————\n发送[1][2][3][4][5][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "5":
            txt = "\n【世界树•地下】\n云海之上。\n◈[1] 前往 黑角竞技场\n◈[2] 前往 黑市\n◈[3] 未知\n◈[4] 未知\n◈[5] 未知\n◈[0] 返回\n————————————\n发送[1][2][3][4][5][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "11":
            txt = "\n【世界树•下层•坊市】\n熙熙攘攘，人流络绎不绝。\n◈[1] 未知\n◈[2] 未知\n◈[3] 未知\n◈[4] 未知\n◈[0] 返回\n————————————\n发送[1][2][3][4][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "12":
            txt = "\n【漠北铁匠铺】\n清脆的打铁声不绝如缕。\n◈[1] 与[漠北]对话\n◈[2] 查看[清单]\n◈[3] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][2][3][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "121":
            txt = "\n【漠北铁匠铺】\n『漠北』\n“瞧瞧，这些可是今天最棒的锻材！”\n◈[1] 关于[矿材]\n◈[2] 关于[锻造师]\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "1212":
            txt = "\n【漠北铁匠铺】\n『漠北』\n“你说你想学打铁？”\n“这工作可不轻松，我劝你三思而后行！”\n◈[1] 成为[锻造师]\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "122":
            with open(f"data/shop/铁匠铺商店.txt", 'r') as f:
                shop_data = json.load(f)
            txt = "\n【漠北铁匠铺】\n『漠北』\n“都是上等的锻材，贵些也正常！”\n————————————"
            for x, shop_item in enumerate(shop_data["当前"]):
                shop_id = x + 1
                txt += "\n【{}】{} (剩余:{})\n   单价：[{}]{}".format(shop_id, shop_item["名称"], shop_item["数量"], shop_item["单个价格"], shop_item["货币类型"])
            txt += "\n————————————\n【发送[购买 名称*数量]进行购买】\n【示例 [购买白晶*99]】\n【发送[离开商店]离开】"
            await txt_write("player", "number", number, "状态", "世界树商店")
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "123":
            txt = "\n【漠北铁匠铺】\n『漠北』\n“咱们这一行可讲究手艺！”\n“拿起锤子试试，让我看看你合不合要求！”\n“打铁打到一半可不能半途而废！”\n————————————\n【发送[开始打工]开始】\n【发送[结束打工]结束】\n【发送[0]返回】"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "13":
            txt = "\n【晴空糖水屋】\n不大的店内，洋溢着令人愉悦的香气。\n◈[1] 与[晴儿]对话\n◈[2] 查看[清单]\n◈[3] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][2][3][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "131":
            txt = "\n【晴空糖水屋】\n『晴儿』\n“嘿嘿，想尝尝本店特色吗，只要10金币一杯哦~”\n◈[1] 购买[闪耀的鲜能剂]\n◈[2] 关于[炼金师]\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "1312":
            txt = "\n【晴空糖水屋】\n『晴儿』\n(微笑)\n“提炼万物之精，汇聚成满满的幸福~”\n“你也想成为酿造美好的炼金嘛~”\n◈[1] 成为[炼金师]\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "132":
            with open(f"data/shop/炼金所商店.txt", 'r') as f:
                shop_data = json.load(f)
            txt = "\n【晴空糖水屋】\n『晴儿』\n“来自天空的馈赠~”\n————————————"
            for x, shop_item in enumerate(shop_data["当前"]):
                shop_id = x + 1
                txt += "\n【{}】{} (剩余:{})\n   单价：[{}]{}".format(shop_id, shop_item["名称"], shop_item["数量"], shop_item["单个价格"], shop_item["货币类型"])
            txt += "\n————————————\n【发送[购买 名称*数量]进行购买】\n【示例 [购买天空粉尘*99]】\n【发送[离开商店]离开】"
            await txt_write("player", "number", number, "状态", "世界树商店")
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "133":
            txt = "\n【晴空糖水屋】\n『晴儿』\n“你说，你是来应聘的？”\n“我们这儿只招炼金师呢，待遇嘛，具体看你的成果啦~”\n“工资一个小时起算哦！”\n————————————\n【发送[开始打工]开始】\n【发送[结束打工]结束】\n【发送[0]返回】"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "14":
            txt = "\n【小茗的道具店】\n墙上摆放着各类物品，让人眼花缭乱。\n◈[1] 与[小茗]对话\n◈[2] 查看[清单]\n◈[3] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][2][3][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "141":
            txt = "\n【小茗的道具店】\n『小茗』\n“盯————”\n“这位客官，我有什么能帮你的吗？”\n◈[1] 分解物品\n◈[2] 关于[分解师]\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "1412":
            txt = "\n【小茗的道具店】\n『小茗』\n“你说我？就像这样————”\n“滋啦！~~~”\n手起刀落，一块块你前所未见的东西掉落在地。\n“你可以感受到事物的旋律，分解出不一般的东西哟~”\n◈[1] 成为[分解师]\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "142":
            with open(f"data/shop/分解屋商店.txt", 'r') as f:
                shop_data = json.load(f)
            txt = "\n【小茗的道具店】\n『小茗』\n“能感受到浓郁的能量嘛？”\n————————————"
            for x, shop_item in enumerate(shop_data["当前"]):
                shop_id = x + 1
                txt += "\n【{}】{} (剩余:{})\n   单价：[{}]{}".format(shop_id, shop_item["名称"], shop_item["数量"], shop_item["单个价格"], shop_item["货币类型"])
            txt += "\n————————————\n【发送[购买 名称*数量]进行购买】\n【示例 [购买血肉残渣*99]】\n【发送[离开商店]离开】"
            await txt_write("player", "number", number, "状态", "世界树商店")
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "143":
            txt = "\n【小茗的道具店】\n『小茗』\n“来帮手啦？”\n“这儿的活可不少呢！”\n“起步一个小时哦~”\n————————————\n【发送[开始打工]开始】\n【发送[结束打工]结束】\n【发送[0]返回】"
            await send_message(message, 0, 1, txt)
        elif place_number_now == "15":
            txt = "\n【纯白记忆】\n刚进门，一只毛茸茸的洁白生物凑到了你的脚边，蹭来蹭去。\n◈[1] 与[小白]对话\n◈[2] 查看[清单]\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        
        
        
        elif place_number_now == "21":
            txt = "\n【世界树•中层•冒险者公会】\n宽敞的大厅内，挤满了许多冒险者。\n◈[1] 走向 前台\n◈[2] 走向 委托板\n◈[3] 走向 悬赏板\n◈[4] 前往 兑换商店\n◈[0] 返回\n————————————\n发送[1][2][3][4][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "211":
            txt = "\n【冒险者公会•前台】"
            if "狐狐" not in heart:
                heart["狐狐"] = 0
            if heart["狐狐"] == 0:
                txt += "\n『狐狐』\n哇哦，是新面孔诶！\n这位冒险者，你是来加入公会的吗？\n现在加入福利多多哦！"
                heart["狐狐"] += 1
            elif heart["狐狐"] < 10:
                txt += "\n『狐狐』\n这位冒险者，有什么可以帮你的吗？"
            elif heart["狐狐"] < 30:
                txt += "\n『狐狐』\n又见面了，最近还都一切顺利吧！"
            txt += "\n◈[1] 加入公会\n◈[2] 等级评定\n◈[3] 聊聊\n◈[4] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][2][3][4][0]进行操作"
            await player_write(number, "好感度", None, heart)
            await send_message(message, 0, 1, txt)
            return

        elif place_number_now == "2113":
            txt = "\n【冒险者公会•前台】"
            if "狐狐" not in heart:
                heart["狐狐"] = 0
            if heart["狐狐"] < 10:
                txt += "\n『狐狐』\n这位冒险者，有什么可以帮你的吗？"
            elif heart["狐狐"] < 30:
                txt += "\n『狐狐』\n嗯哼~\n怎么今天有闲情雅致，一起来聊聊？"
            txt += "\n◈[1] 关于等阶突破\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await player_write(number, "好感度", None, heart)
            await send_message(message, 0, 1, txt)
            return

        elif place_number_now == "2114":
            txt = "\n【冒险者公会•前台】\n『狐狐』\n“我们这儿的确是需要几个专业陪练。”\n“不过会比较辛苦，每天要陪不少人演练招式~”\n“你能行吗？”\n————————————\n【发送[开始打工]开始】\n【发送[结束打工]结束】\n【发送[0]返回】"
            await send_message(message, 0, 1, txt)
            return
        
        elif place_number_now == "212":
            txt = "\n【冒险者公会•委托板】\n不定时会发布委托任务。\n◈[1] 查看委托\n◈[2] 发布委托\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "213":
            txt = "\n【冒险者公会•悬赏板】\n时不时会有人发布高难度悬赏任务。\n◈[1] 查看悬赏\n◈[2] 发布悬赏\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return


        elif place_number_now == "22":
            txt = "\n【世界树•中层•世界图书馆】\n巍峨的老式建筑，宛若一座巨大的白玉城堡。\n◈[1] 前往 图书馆正厅\n◈[2] 前往 无尽回廊\n◈[3] 前往 瞭望台\n◈[0] 返回\n————————————\n发送[1][2][3][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "222":
            txt = "\n【世界图书馆•无尽回廊】\n深邃的过道，无尽的门户，象征着数不胜数的知识与钻研。\n◈[1] 寻访 [噶]的研究室\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "2221":
            txt = "\n【世界图书馆•[噶]的研究室】\n『噶』\n“你准备好了吗？”\n◈[1] 开始试炼/完成试炼\n◈[2] 每日委托\n◈[3] 关于[等阶突破]\n◈[0] 返回\n————————————\n发送[1][2][3][0]进行操作"
            await send_message(message, 0, 1, txt)
            return

        elif place_number_now == "24":
            txt = "\n【世界树•中层•世界传送门】\n一座巨大的传送法阵，有不少强者看守。\n◈发送[传送x*y]进行传送\n【需花费[200]铜币】\n◈[1] 询问[招聘]\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return

        elif place_number_now == "241":
            txt = "\n【世界传送门】\n『传送门守卫』\n“最近有不少可疑分子在这儿走私违禁品。”\n“你的任务就是观察每一个行者，并揪出不法之徒！”\n“明白了吗！”\n————————————\n【发送[开始打工]开始】\n【发送[结束打工]结束】\n【发送[0]返回】"
            await send_message(message, 0, 1, txt)
            return
        
        
        
        elif place_number_now == "31":
            txt = "\n【世界树•诸神殿堂】\n殿堂内四方，分别矗立着一座雕像。\n每座雕像都透露出神圣的气息。\n◈[1] 仰望 战神\n◈[2] 仰望 魔神\n◈[3] 仰望 生命女神\n◈[4] 仰望 虚空\n◈[0] 返回\n————————————\n发送[1][2][3][4][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "311":
            txt = "\n【诸神殿堂•战神】\n你的耳边仿佛传来沉重的话语。\n“来自异乡的勇士啊，你愿成为团队的利剑还是坚盾？”\n◈[1] 选择 利剑\n◈[2] 选择 坚盾\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3111":
            txt = "\n【诸神殿堂•战神】\n“我这一击可碎日月星辰！”\n◈[1] 职业选择\n◈[2] 技能领悟\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "31111":
            txt = "\n【诸神殿堂•战神】\n“我这一击可碎日月星辰！”\n◈[1] 转职 战士\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "31112":
            need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
            skill_all = await player_read(number, "学会技能")
            skill1_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "生命吸收"] or [0])[0])
            thing1 = list(need.keys())[skill1_level]
            number1 = list(need.values())[skill1_level]
            value11 = skill1_level * 6
            value12 = (skill1_level + 1) * 6
            skill2_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "洪荒之力"] or [0])[0])
            thing2 = list(need.keys())[skill2_level]
            number2 = list(need.values())[skill2_level] * 10
            value21 = skill2_level
            value22 = skill2_level + 1
            txt = "\n【诸神殿堂•战神】\n“我这一击可碎日月星辰！”\n◈[1] 学习 生命吸收\n  (需供奉[{}]×{})\n【你造成物理伤害时，回复等同于({}→{})%伤害的生命值】\n◈[2] 学习 洪荒之力\n  (需供奉[{}]×{})\n【你的攻击力得到提升，相当于({}→{})%最大生命值】\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作".format(thing1, number1, value11, value12, thing2, number2, value21, value22)
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3112":
            txt = "\n【诸神殿堂•战神】\n“天塌了，我也顶得住！”\n◈[1] 职业选择\n◈[2] 技能领悟\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "31121":
            txt = "\n【诸神殿堂•战神】\n“天塌了，我也顶得住！”\n◈[1] 转职 盾守\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "31122":
            need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
            skill_all = await player_read(number, "学会技能")
            skill1_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "生命涓流"] or [0])[0])
            thing1 = list(need.keys())[skill1_level]
            number1 = list(need.values())[skill1_level]
            value11 = skill1_level * 8
            value12 = (skill1_level + 1) * 8
            value13 = round(skill1_level * 0.5, 1)
            value14 = round((skill1_level + 1) * 0.5, 1)
            skill2_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "不灭意志"] or [0])[0])
            thing2 = list(need.keys())[skill2_level]
            number2 = list(need.values())[skill2_level] * 10
            value21 = round(skill2_level * 0.2, 1)
            value22 = round((skill2_level + 1) * 0.2, 1)
            txt = "\n【诸神殿堂•战神】\n“天塌了，我也顶得住！”\n◈[1] 学习 生命涓流\n  (需供奉[{}]×{})\n【你的最大生命值增加({}→{})%】\n【战斗时，每回合回复({}→{})%最大生命值】\n◈[2] 学习 不灭意志\n  (需供奉[{}]×{})\n【你每低于1%最大生命，增加({}→{})%所有生命回复】\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作".format(thing1, number1, value11, value12, value13, value14, thing2, number2, value21, value22)
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "312":
            txt = "\n【诸神殿堂•魔神】\n隐约传来饱含沧桑的话语。\n“自古留存的元素，才是大陆的主宰。”\n◈[1] 职业选择\n◈[2] 技能领悟\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3121":
            txt = "\n【诸神殿堂•魔神】\n隐约传来饱含沧桑的话语。\n“元素与你同在。”\n◈[1] 转职 法师\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3122":
            need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
            skill_all = await player_read(number, "学会技能")
            skill1_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "魔力涌动"] or [0])[0])
            thing1 = list(need.keys())[skill1_level]
            number1 = list(need.values())[skill1_level]
            value11 = skill1_level * 8
            value12 = (skill1_level + 1) * 8
            value13 = round(skill1_level * 0.5, 1)
            value14 = round((skill1_level + 1) * 0.5, 1)
            skill2_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "元素爆发"] or [0])[0])
            thing2 = list(need.keys())[skill2_level]
            number2 = list(need.values())[skill2_level] * 10
            value21 = skill2_level * 30
            value22 = (skill2_level + 1) * 30
            value31 = skill2_level * 10
            value32 = (skill2_level + 1) * 10
            txt = "\n【诸神殿堂•魔神】\n隐约传来饱含沧桑的话语。\n“元素与你同在。”\n◈[1] 学习 魔力涌动\n  (需供奉[{}]×{})\n【你的最大魔力值增加({}→{})%】\n【战斗时，每回合回复({}→{})%最大魔力值】\n◈[2] 学习 元素爆发\n  (需供奉[{}]×{})\n【解锁暴伤上限({}→{})%。你的魔法技能暴击时，最终伤害提升({}→{})%】\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作".format(thing1, number1, value11, value12, value13, value14, thing2, number2, value21, value22, value31, value32)
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "313":
            txt = "\n【诸神殿堂•生命女神】\n周围蕴含着无比浓郁的生机。\n“你也和我一样么……”\n◈[1] 职业选择\n◈[2] 技能领悟\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3131":
            txt = "\n【诸神殿堂•生命女神】\n“我平等的爱惜每一个生灵。”\n◈[1] 转职 牧师\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3132":
            need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
            skill_all = await player_read(number, "学会技能")
            skill1_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "医者仁心"] or [0])[0])
            thing1 = list(need.keys())[skill1_level]
            number1 = list(need.values())[skill1_level]
            value11 = skill1_level * 10
            value12 = (skill1_level + 1) * 10
            value13 = skill1_level * 8
            value14 = (skill1_level + 1) * 8
            skill2_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "律者箴言"] or [0])[0])
            thing2 = list(need.keys())[skill2_level]
            number2 = list(need.values())[skill2_level] * 10
            value21 = skill2_level * 10
            value22 = (skill2_level + 1) * 10
            txt = "\n【诸神殿堂•生命女神】\n“我平等的爱惜每一个生灵。”\n◈[1] 学习 医者仁心\n  (需供奉[{}]×{})\n【你的治疗量提升({}→{})%】\n【你的所有技能消耗降低({}→{})%】\n◈[2] 学习 律者箴言\n  (需供奉[{}]×{})\n【你的Buff类技能效果提升({}→{})%】\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作".format(thing1, number1, value11, value12, value13, value14, thing2, number2, value21, value22)
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "314":
            txt = "\n【诸神殿堂•虚空】\n只有一个底座，完全不见雕像的踪影。\n◈[1] 职业选择\n◈[2] 技能领悟\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3141":
            txt = "\n【诸神殿堂•虚空】\n背后突现的滔天杀意让你心神一凛，但又立马消失不见。\n“呵呵……”\n隐晦戏谑的笑声。\n◈[1] 转职 刺客\n◈[0] 返回\n————————————\n发送[1][0]进行操作"
            await send_message(message, 0, 1, txt)
            return
        elif place_number_now == "3142":
            need = {"天空粉尘": 1, "天空碎片": 1, "天空晶石": 1, "天空结晶": 1, "天空回响": 1, "鸿蒙之息": 1}
            skill_all = await player_read(number, "学会技能")
            skill1_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "杀意感知"] or [0])[0])
            thing1 = list(need.keys())[skill1_level]
            number1 = list(need.values())[skill1_level]
            value11 = skill1_level * 8
            value12 = (skill1_level + 1) * 8
            value13 = skill1_level * 2
            value14 = (skill1_level + 1) * 2
            skill2_level = int(([skill["等级"] for skill in skill_all if skill["名称"] == "弱点洞察"] or [0])[0])
            thing2 = list(need.keys())[skill2_level]
            number2 = list(need.values())[skill2_level] * 10
            value21 = math.ceil(skill2_level / 3)
            value22 = math.ceil((skill2_level + 1) / 3)
            value31 = skill2_level * 10
            value32 = (skill2_level + 1) * 10
            txt = "\n【诸神殿堂•虚空】\n背后突现的滔天杀意让你心神一凛，但又立马消失不见。\n“呵呵……”\n隐晦戏谑的笑声。\n◈[1] 学习 杀意感知\n  (需供奉[{}]×{})\n【你的闪避值增加({}→{})%】\n【每次闪避时，叠加一层[急速]；每层急速可使你的速度提升({}→{})%，被击中时重置】\n◈[2] 学习 弱点洞察\n  (需供奉[{}]×{})\n【解锁追击上限({}→{})次。且你有几率直击敌人的弱点，取决于你与敌人的速度。弱点攻击时，伤害提升({}→{})%】\n◈[0] 返回\n————————————\n发送[1][2][0]进行操作".format(thing1, number1, value11, value12, value13, value14, thing2, number2, value21, value22, value31, value32)
            await send_message(message, 0, 1, txt)
            return



    







